Class FieldAccessor
java.lang.Object
nl.jqno.equalsverifier.internal.reflection.FieldAccessor
Provides reflective access to one field of an object.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines whether the field can be modified using reflection.boolean
boolean
boolean
boolean
boolean
Tries to get the field's value.getField()
Class<?>
static FieldAccessor
Factory method.
-
Method Details
-
of
Factory method.- Parameters:
field
- The field to access.- Returns:
- A
FieldAccessor
forfield
.
-
getField
- Returns:
- The field itself.
-
getFieldType
- Returns:
- The field's type.
-
getFieldName
- Returns:
- The field's name.
-
fieldIsPrimitive
public boolean fieldIsPrimitive()- Returns:
- Whether the field is of a primitive type.
-
fieldIsFinal
public boolean fieldIsFinal()- Returns:
- Whether the field is marked with the final modifier.
-
fieldIsStatic
public boolean fieldIsStatic()- Returns:
- Whether the field is marked with the static modifier.
-
fieldIsTransient
public boolean fieldIsTransient()- Returns:
- Whether the field is marked with the transient modifier.
-
fieldIsEmptyOrSingleValueEnum
public boolean fieldIsEmptyOrSingleValueEnum()- Returns:
- Whether the field is an enum with a single value.
-
get
Tries to get the field's value.- Parameters:
object
- The object that contains the field whose value we want to get.- Returns:
- The field's value.
- Throws:
ReflectionException
- If the operation fails.
-
canBeModifiedReflectively
public boolean canBeModifiedReflectively()Determines whether the field can be modified using reflection.- Returns:
- Whether or not the field can be modified reflectively.
-