Class InstanceField
java.lang.Object
org.mockito.internal.util.reflection.InstanceField
Represents an accessible instance field.
Contains the instance reference on which the field can be read and write.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
Aannotation(Class<A> annotationClass) Returns the annotation instance for the given annotation type.booleaninthashCode()booleanisAnnotatedBy(Class<? extends Annotation> annotationClass) Check if the field is annotated by the given annotation.booleanisNull()Check that the field is not null.booleanCheck if the field is synthetic.jdkField()Returns the JDKFieldinstance.name()Returns the name of the field.read()Safely read the field.private FieldReaderreader()voidSet the given value to the field of this instance.toString()
-
Field Details
-
field
-
instance
-
fieldReader
-
-
Constructor Details
-
InstanceField
-
-
Method Details
-
read
-
set
Set the given value to the field of this instance.- Parameters:
value- The value that should be written to the field.
-
isNull
public boolean isNull()Check that the field is not null.- Returns:
trueifnull, elsefalse.
-
isAnnotatedBy
Check if the field is annotated by the given annotation.- Parameters:
annotationClass- The annotation type to check.- Returns:
trueif the field is annotated by this annotation, elsefalse.
-
isSynthetic
public boolean isSynthetic()Check if the field is synthetic.- Returns:
trueif the field is synthetic, elsefalse.
-
annotation
Returns the annotation instance for the given annotation type.- Type Parameters:
A- Type of the annotation.- Parameters:
annotationClass- Tha annotation type to retrieve.- Returns:
- The annotation instance.
-
jdkField
-
reader
-
name
-
toString
-
equals
-
hashCode
-