Package ru.objectsfill.utils
Class FieldUtils
java.lang.Object
ru.objectsfill.utils.FieldUtils
Utility class for working with fields in Java classes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddoWithFields(Class<?> clazz, FieldCallback fc) Invokes the given FieldCallback for each field in the specified class and its superclasses.getExtFillParam(Field field, Fill fill) static UnaryOperator<Object>getObjectUnaryOperator(Fill fill) get wrap function or default t -> t.static UnaryOperator<Object>getObjectUnaryOperator(Fill fill, Field field) get wrap function or default t -> t.
-
Method Details
-
doWithFields
Invokes the given FieldCallback for each field in the specified class and its superclasses.- Parameters:
clazz- the class to process fields forfc- the FieldCallback to invoke for each field- Throws:
IllegalArgumentException- if the class is nullIllegalStateException- if the FieldCallback encounters an error while processing a field
-
getObjectUnaryOperator
get wrap function or default t -> t. If we don't have reference to field- Parameters:
fill- the `Fill` object containing the generation parameters- Returns:
- function
-
getObjectUnaryOperator
get wrap function or default t -> t. If we don't have reference to field- Parameters:
fill- the `Fill` object containing the generation parametersfield- The field for which the collection stream is being filled.- Returns:
- function
-
getExtFillParam
- Parameters:
field- The field for which the collection stream is being filled.fill- The Fill object containing the necessary information for generation.- Returns:
- extended parameter for some field
-