Package de.cronn.reflection.util
Class PropertyUtils
java.lang.Object
de.cronn.reflection.util.PropertyUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcopyNonDefaultValues(T source, T destination) static <T> TcopyNonDefaultValues(T source, T destination, PropertyDescriptor... excludedProperties) static <T> TcopyNonDefaultValues(T source, T destination, Collection<PropertyDescriptor> excludedProperties) static <T> ObjectcopyValue(T source, T destination, PropertyDescriptor propertyDescriptor) static <T> MethodfindMethodByGetter(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) static <A extends Annotation>
AgetAnnotationOfProperty(Class<?> entityType, PropertyDescriptor descriptor, Class<A> annotationClass) static <T,A extends Annotation>
AgetAnnotationOfProperty(Class<T> entityType, TypedPropertyGetter<T, ?> propertyGetter, Class<A> annotationClass) static <A extends Annotation>
AgetAnnotationOfProperty(Object object, PropertyDescriptor descriptor, Class<A> annotationClass) static <T> ObjectgetDefaultValue(Class<T> objectClass, PropertyDescriptor propertyDescriptor) static ObjectgetDefaultValueObject(Class<?> type) static <T> @NotNull MethodgetMethod(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) static <T> @NotNull PropertyDescriptorgetPropertyDescriptor(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) static <T> @NotNull PropertyDescriptorgetPropertyDescriptor(T bean, TypedPropertyGetter<T, ?> propertyGetter) static <T> @Nullable PropertyDescriptorgetPropertyDescriptorByField(Class<T> beanClass, Field field) static <T> @Nullable PropertyDescriptorgetPropertyDescriptorByMethod(Class<T> beanClass, Method method) static @Nullable PropertyDescriptorgetPropertyDescriptorByName(Class<?> beanClass, String propertyName) static @Nullable PropertyDescriptorgetPropertyDescriptorByName(Object bean, String propertyName) static @NotNull PropertyDescriptorgetPropertyDescriptorByNameOrThrow(Class<?> beanClass, String propertyName) static @NotNull PropertyDescriptorgetPropertyDescriptorByNameOrThrow(Object bean, String propertyName) static Collection<PropertyDescriptor> getPropertyDescriptors(Class<?> type) static Collection<PropertyDescriptor> getPropertyDescriptors(Object object) static <A extends Annotation>
Map<PropertyDescriptor, A> getPropertyDescriptorsWithAnnotation(Class<?> type, Class<A> annotationClass) static <A extends Annotation>
Map<PropertyDescriptor, A> getPropertyDescriptorsWithAnnotation(Object object, Class<A> annotationClass) static <T> @NotNull StringgetPropertyName(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) static <T> @NotNull StringgetPropertyName(T bean, TypedPropertyGetter<T, ?> propertyGetter) static StringgetQualifiedPropertyName(Class<?> type, PropertyDescriptor propertyDescriptor) static StringgetQualifiedPropertyName(Class<?> type, String name) static <T> StringgetQualifiedPropertyName(Class<T> type, TypedPropertyGetter<T, ?> propertyGetter) static StringgetQualifiedPropertyName(Object bean, PropertyDescriptor propertyDescriptor) static <T> StringgetQualifiedPropertyName(T bean, TypedPropertyGetter<T, ?> propertyGetter) static booleanhasAnnotationOfProperty(Class<?> entityType, PropertyDescriptor descriptor, Class<? extends Annotation> annotationClass) static <T> booleanhasDefaultValue(T bean, PropertyDescriptor propertyDescriptor) static <T> booleanhasDifferentValue(T a, T b, PropertyDescriptor propertyDescriptor) static booleanhasProperty(Class<?> beanClass, String propertyName) static booleanhasProperty(Object bean, String propertyName) static <T> booleanhasSameValue(T a, T b, PropertyDescriptor propertyDescriptor) static booleanisCollectionType(PropertyDescriptor propertyDescriptor) static booleanisDeclaredInClass(PropertyDescriptor propertyDescriptor, Class<?> entityClass) static <T> booleanisDefaultValue(Class<T> objectClass, TypedPropertyGetter<T, ?> propertyGetter, Object value) static <T> booleanisDefaultValue(Class<T> objectClass, PropertyDescriptor propertyDescriptor, Object value) static booleanisFullyAccessible(PropertyDescriptor descriptor) static booleanisNotCollectionType(PropertyDescriptor propertyDescriptor) static booleanisReadable(PropertyDescriptor descriptor) static booleanisWritable(PropertyDescriptor descriptor) static <T> Tread(Object source, PropertyDescriptor propertyDescriptor) static <T> Tread(Object source, PropertyDescriptor propertyDescriptor, boolean force) static <T> TreadDirectly(Object object, PropertyDescriptor propertyDescriptor) static <T> TreadDirectly(Object object, Field field) static <T> TreadDirectly(Object object, String propertyName) static <T> TreadIfPropertyExists(Object source, String propertyName) static <T> TreadProperty(Object entity, PropertyDescriptor propertyDescriptor, Class<T> expectedType) static voidwrite(Object destination, PropertyDescriptor propertyDescriptor, Object value) static voidwrite(Object destination, PropertyDescriptor propertyDescriptor, Object value, boolean force) static voidstatic voidwriteDirectly(Object destination, PropertyDescriptor propertyDescriptor, Object value) static voidwriteDirectly(Object destination, Field field, Object value) static voidwriteDirectly(Object destination, String propertyName, Object value) static <T> voidwriteIfPropertyExists(Object destination, String propertyName, Supplier<T> valueSupplier)
-
Method Details
-
getPropertyDescriptorByName
@Nullable public static @Nullable PropertyDescriptor getPropertyDescriptorByName(Object bean, String propertyName) -
getPropertyDescriptorByName
@Nullable public static @Nullable PropertyDescriptor getPropertyDescriptorByName(Class<?> beanClass, String propertyName) -
getPropertyDescriptorByNameOrThrow
@NotNull public static @NotNull PropertyDescriptor getPropertyDescriptorByNameOrThrow(Object bean, String propertyName) -
getPropertyDescriptorByNameOrThrow
@NotNull public static @NotNull PropertyDescriptor getPropertyDescriptorByNameOrThrow(Class<?> beanClass, String propertyName) -
getPropertyDescriptors
-
getPropertyDescriptors
-
getPropertyDescriptorsWithAnnotation
public static <A extends Annotation> Map<PropertyDescriptor,A> getPropertyDescriptorsWithAnnotation(Object object, Class<A> annotationClass) -
getPropertyDescriptorsWithAnnotation
public static <A extends Annotation> Map<PropertyDescriptor,A> getPropertyDescriptorsWithAnnotation(Class<?> type, Class<A> annotationClass) -
copyNonDefaultValues
public static <T> T copyNonDefaultValues(T source, T destination) -
copyNonDefaultValues
public static <T> T copyNonDefaultValues(T source, T destination, PropertyDescriptor... excludedProperties) -
copyNonDefaultValues
public static <T> T copyNonDefaultValues(T source, T destination, Collection<PropertyDescriptor> excludedProperties) -
copyValue
-
hasDefaultValue
-
hasSameValue
-
hasDifferentValue
-
isDefaultValue
public static <T> boolean isDefaultValue(Class<T> objectClass, TypedPropertyGetter<T, ?> propertyGetter, Object value) -
isDefaultValue
public static <T> boolean isDefaultValue(Class<T> objectClass, PropertyDescriptor propertyDescriptor, Object value) -
getDefaultValue
public static <T> Object getDefaultValue(Class<T> objectClass, PropertyDescriptor propertyDescriptor) -
write
-
writeIfPropertyExists
-
write
-
write
public static void write(Object destination, PropertyDescriptor propertyDescriptor, Object value, boolean force) -
writeDirectly
public static void writeDirectly(Object destination, PropertyDescriptor propertyDescriptor, Object value) -
writeDirectly
-
writeDirectly
-
readDirectly
-
readDirectly
-
readDirectly
-
read
-
read
-
readIfPropertyExists
-
readProperty
public static <T> T readProperty(Object entity, PropertyDescriptor propertyDescriptor, Class<T> expectedType) -
getPropertyDescriptor
@NotNull public static <T> @NotNull PropertyDescriptor getPropertyDescriptor(T bean, TypedPropertyGetter<T, ?> propertyGetter) -
getPropertyDescriptor
@NotNull public static <T> @NotNull PropertyDescriptor getPropertyDescriptor(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) -
getPropertyName
@NotNull public static <T> @NotNull String getPropertyName(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) -
getPropertyName
@NotNull public static <T> @NotNull String getPropertyName(T bean, TypedPropertyGetter<T, ?> propertyGetter) -
getPropertyDescriptorByMethod
@Nullable public static <T> @Nullable PropertyDescriptor getPropertyDescriptorByMethod(Class<T> beanClass, Method method) -
getPropertyDescriptorByField
@Nullable public static <T> @Nullable PropertyDescriptor getPropertyDescriptorByField(Class<T> beanClass, Field field) -
getMethod
@NotNull public static <T> @NotNull Method getMethod(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) -
findMethodByGetter
public static <T> Method findMethodByGetter(Class<T> beanClass, TypedPropertyGetter<T, ?> propertyGetter) -
hasAnnotationOfProperty
public static boolean hasAnnotationOfProperty(Class<?> entityType, PropertyDescriptor descriptor, Class<? extends Annotation> annotationClass) -
getAnnotationOfProperty
public static <T,A extends Annotation> A getAnnotationOfProperty(Class<T> entityType, TypedPropertyGetter<T, ?> propertyGetter, Class<A> annotationClass) -
getAnnotationOfProperty
public static <A extends Annotation> A getAnnotationOfProperty(Object object, PropertyDescriptor descriptor, Class<A> annotationClass) -
getAnnotationOfProperty
public static <A extends Annotation> A getAnnotationOfProperty(Class<?> entityType, PropertyDescriptor descriptor, Class<A> annotationClass) -
isFullyAccessible
-
isWritable
-
isReadable
-
isDeclaredInClass
public static boolean isDeclaredInClass(PropertyDescriptor propertyDescriptor, Class<?> entityClass) -
hasProperty
-
hasProperty
-
getDefaultValueObject
-
getQualifiedPropertyName
-
getQualifiedPropertyName
public static <T> String getQualifiedPropertyName(Class<T> type, TypedPropertyGetter<T, ?> propertyGetter) -
getQualifiedPropertyName
-
getQualifiedPropertyName
-
getQualifiedPropertyName
-
isCollectionType
-
isNotCollectionType
-