Class Fields
java.lang.Object
org.mockito.internal.util.reflection.Fields
Small fluent reflection tools to work with fields.
Code is very new and might need rework.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Fields.InstanceFields
allDeclaredFieldsOf
(Object instance) Instance fields declared in the class and superclasses of the given instance.static ListUtil.Filter<InstanceField>
annotatedBy
(Class<? extends Annotation>... annotations) Accept fields annotated by the given annotations.static Fields.InstanceFields
declaredFieldsOf
(Object instance) Instance fields declared in the class of the given instance.private static List<InstanceField>
instanceFieldsIn
(Object instance, Field[] fields) private static ListUtil.Filter<InstanceField>
Accept fields with non null value.static ListUtil.Filter<InstanceField>
Accept fields with non null value.
-
Constructor Details
-
Fields
public Fields()
-
-
Method Details
-
allDeclaredFieldsOf
Instance fields declared in the class and superclasses of the given instance.- Parameters:
instance
- Instance from which declared fields will be retrieved.- Returns:
- InstanceFields of this object instance.
-
declaredFieldsOf
Instance fields declared in the class of the given instance.- Parameters:
instance
- Instance from which declared fields will be retrieved.- Returns:
- InstanceFields of this object instance.
-
instanceFieldsIn
-
annotatedBy
public static ListUtil.Filter<InstanceField> annotatedBy(Class<? extends Annotation>... annotations) Accept fields annotated by the given annotations.- Parameters:
annotations
- Annotation types to check.- Returns:
- The filter.
-
nullField
Accept fields with non null value.- Returns:
- The filter.
-
syntheticField
Accept fields with non null value.- Returns:
- The filter.
-