Class Fields
- java.lang.Object
-
- org.mockito.internal.util.reflection.Fields
-
public abstract class Fields extends java.lang.Object
Small fluent reflection tools to work with fields. Code is very new and might need rework.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Fields.InstanceFields
-
Constructor Summary
Constructors Constructor Description Fields()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Fields.InstanceFields
allDeclaredFieldsOf(java.lang.Object instance)
Instance fields declared in the class and superclasses of the given instance.static ListUtil.Filter<InstanceField>
annotatedBy(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Accept fields annotated by the given annotations.static Fields.InstanceFields
declaredFieldsOf(java.lang.Object instance)
Instance fields declared in the class of the given instance.private static java.util.List<InstanceField>
instanceFieldsIn(java.lang.Object instance, java.lang.reflect.Field[] fields)
private static ListUtil.Filter<InstanceField>
nullField()
Accept fields with non null value.static ListUtil.Filter<InstanceField>
syntheticField()
Accept fields with non null value.
-
-
-
Method Detail
-
allDeclaredFieldsOf
public static Fields.InstanceFields allDeclaredFieldsOf(java.lang.Object instance)
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
public static Fields.InstanceFields declaredFieldsOf(java.lang.Object instance)
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
private static java.util.List<InstanceField> instanceFieldsIn(java.lang.Object instance, java.lang.reflect.Field[] fields)
-
annotatedBy
public static ListUtil.Filter<InstanceField> annotatedBy(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Accept fields annotated by the given annotations.- Parameters:
annotations
- Annotation types to check.- Returns:
- The filter.
-
nullField
private static ListUtil.Filter<InstanceField> nullField()
Accept fields with non null value.- Returns:
- The filter.
-
syntheticField
public static ListUtil.Filter<InstanceField> syntheticField()
Accept fields with non null value.- Returns:
- The filter.
-
-