/// <summary> /// Does class member attribute of given type have a PropertyDrawer? /// </summary> /// <param name="classMemberOrAttributeType"> Type of class member or attribute. </param> /// <returns> True if class has a PropertyDrawer, false if not. </returns> public static bool HasPropertyDrawer([NotNull] Type classMemberOrAttributeType) { if (PropertyDrawersByType.ContainsKey(classMemberOrAttributeType)) { return(true); } if (classMemberOrAttributeType.IsGenericType && !classMemberOrAttributeType.IsGenericTypeDefinition) { return(propertyDrawersByType.ContainsKey(classMemberOrAttributeType.GetGenericTypeDefinition())); } return(false); }
/// <summary> /// Attempts to get PropertyDrawer Type for given class. /// </summary> /// <param name="classMemberOrAttributeType"> Type of the class for which we are trying to find the PropertyDrawer. </param> /// <param name="propertyDrawerType"> [out] Type of the PropertyDrawer. </param> /// <returns> True if target has a PropertyDrawer, false if not. </returns> public static bool TryGetPropertyDrawerType([NotNull] Type classMemberOrAttributeType, out Type propertyDrawerType) { if (PropertyDrawersByType.TryGetValue(classMemberOrAttributeType, out propertyDrawerType)) { return(true); } if (classMemberOrAttributeType.IsGenericType && !classMemberOrAttributeType.IsGenericTypeDefinition) { return(propertyDrawersByType.TryGetValue(classMemberOrAttributeType.GetGenericTypeDefinition(), out propertyDrawerType)); } return(false); }
/// <summary> /// Attempts to get PropertyDrawer Type for given class. /// </summary> /// <param name="classMemberOrAttributeType"> /// Type of the class for which we are trying to find the PropertyDrawer. </param> /// <param name="drawerType"> /// [out] Type of the PropertyDrawer. </param> /// <returns> /// True if target has a PropertyDrawer, false if not. /// </returns> public static bool TryGetPropertyDrawerType([NotNull] Type classMemberOrAttributeType, out Type drawerType) { return(PropertyDrawersByType.TryGetValue(classMemberOrAttributeType, out drawerType)); }