Class FieldModifier
java.lang.Object
nl.jqno.equalsverifier.internal.reflection.FieldModifier
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changeField
(PrefabValues prefabValues, TypeTag enclosingType) Changes the field's value to something else.void
Copies field's value to the corresponding field in the specified object.void
Tries to make the field null.void
Tries to make the field null.static FieldModifier
Factory method.void
Tries to set the field to the specified value.
-
Method Details
-
of
Factory method.- Parameters:
field
- The field to modify.object
- An object that contains the field we want to modify.- Returns:
- A
FieldModifier
forfield
inobject
.
-
set
Tries to set the field to the specified value.Includes static fields but ignores fields that can't be modified reflectively.
- Parameters:
value
- The value that the field should get.- Throws:
ReflectionException
- If the operation fails.
-
defaultField
public void defaultField()Tries to make the field null. Ignores static fields and fields that can't be modified reflectively.- Throws:
ReflectionException
- If the operation fails.
-
defaultStaticField
public void defaultStaticField()Tries to make the field null. Includes static fields but ignores fields that can't be modified reflectively.- Throws:
ReflectionException
- If the operation fails.
-
copyTo
Copies field's value to the corresponding field in the specified object.Ignores static fields and fields that can't be modified reflectively.
- Parameters:
to
- The object into which to copy the field.- Throws:
ReflectionException
- If the operation fails.
-
changeField
Changes the field's value to something else. The new value will never be null. Other than that, the precise value is undefined.Ignores static fields and fields that can't be modified reflectively.
- Parameters:
prefabValues
- If the field is of a type contained within prefabValues, the new value will be taken from it.enclosingType
- A tag for the type that contains the field. Needed to determine a generic type, if it has one..- Throws:
ReflectionException
- If the operation fails.
-