Class JavaBeanUtils
java.lang.Object
org.apache.beam.sdk.schemas.utils.JavaBeanUtils
A set of utilities to generate getter and setter classes for JavaBean objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map
<ReflectUtils.TypeDescriptorWithSchema<?>, SchemaUserTypeCreator> static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
K extends Comparable<? super K>>
Comparator<T> comparingNullFirst
(Function<? super T, ? extends @Nullable K> keyExtractor) static <T> SchemaUserTypeCreator
createConstructorCreator
(Class<T> clazz, Constructor<T> constructor, Schema schema, List<FieldValueTypeInformation> types, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static <ObjectT extends @NonNull Object,
ValueT>
FieldValueGetter<ObjectT, ValueT> createGetter
(FieldValueTypeInformation typeInformation, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static <ObjectT,
ValueT>
FieldValueSetter<ObjectT, ValueT> createSetter
(FieldValueTypeInformation typeInformation, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static <T> SchemaUserTypeCreator
createStaticCreator
(Class<T> clazz, Method creator, Schema schema, List<FieldValueTypeInformation> types, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static SchemaUserTypeCreator
getConstructorCreator
(TypeDescriptor<?> typeDescriptor, Constructor constructor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static List
<FieldValueTypeInformation> getFieldTypes
(TypeDescriptor<?> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier) static <T> List
<FieldValueGetter<@NonNull T, Object>> getGetters
(TypeDescriptor<T> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) Return the list ofFieldValueGetter
s for a Java Bean classstatic List
<FieldValueSetter> getSetters
(TypeDescriptor<?> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) Return the list ofFieldValueSetter
s for a Java Bean classstatic SchemaUserTypeCreator
getStaticCreator
(TypeDescriptor<?> typeDescriptor, Method creator, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) static Schema
schemaFromJavaBeanClass
(TypeDescriptor<?> typeDescriptor, FieldValueTypeSupplier fieldValueTypeSupplier) Create aSchema
for a Java Bean class.static void
validateJavaBean
(List<FieldValueTypeInformation> getters, List<FieldValueTypeInformation> setters, Schema schema)
-
Field Details
-
GETTER_WITH_NULL_METHOD_ERROR
-
SETTER_WITH_NULL_METHOD_ERROR
-
CACHED_CREATORS
public static final Map<ReflectUtils.TypeDescriptorWithSchema<?>,SchemaUserTypeCreator> CACHED_CREATORS
-
-
Constructor Details
-
JavaBeanUtils
public JavaBeanUtils()
-
-
Method Details
-
schemaFromJavaBeanClass
public static Schema schemaFromJavaBeanClass(TypeDescriptor<?> typeDescriptor, FieldValueTypeSupplier fieldValueTypeSupplier) Create aSchema
for a Java Bean class. -
validateJavaBean
public static void validateJavaBean(List<FieldValueTypeInformation> getters, List<FieldValueTypeInformation> setters, Schema schema) -
getFieldTypes
public static List<FieldValueTypeInformation> getFieldTypes(TypeDescriptor<?> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier) -
getGetters
public static <T> List<FieldValueGetter<@NonNull T,Object>> getGetters(TypeDescriptor<T> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) Return the list ofFieldValueGetter
s for a Java Bean classThe returned list is ordered by the order of fields in the schema.
-
createGetter
public static <ObjectT extends @NonNull Object,ValueT> FieldValueGetter<ObjectT,ValueT> createGetter(FieldValueTypeInformation typeInformation, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
getSetters
public static List<FieldValueSetter> getSetters(TypeDescriptor<?> typeDescriptor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) Return the list ofFieldValueSetter
s for a Java Bean classThe returned list is ordered by the order of fields in the schema.
-
createSetter
public static <ObjectT,ValueT> FieldValueSetter<ObjectT,ValueT> createSetter(FieldValueTypeInformation typeInformation, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
getConstructorCreator
public static SchemaUserTypeCreator getConstructorCreator(TypeDescriptor<?> typeDescriptor, Constructor constructor, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
createConstructorCreator
public static <T> SchemaUserTypeCreator createConstructorCreator(Class<T> clazz, Constructor<T> constructor, Schema schema, List<FieldValueTypeInformation> types, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
getStaticCreator
public static SchemaUserTypeCreator getStaticCreator(TypeDescriptor<?> typeDescriptor, Method creator, Schema schema, FieldValueTypeSupplier fieldValueTypeSupplier, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
createStaticCreator
public static <T> SchemaUserTypeCreator createStaticCreator(Class<T> clazz, Method creator, Schema schema, List<FieldValueTypeInformation> types, ByteBuddyUtils.TypeConversionsFactory typeConversionsFactory) -
comparingNullFirst
public static <T,K extends Comparable<? super K>> Comparator<T> comparingNullFirst(Function<? super T, ? extends @Nullable K> keyExtractor)
-