Class FieldModifier
java.lang.Object
nl.jqno.equalsverifier.internal.reflection.FieldModifier
-
Method Summary
Modifier and TypeMethodDescriptionvoidchangeField(PrefabValues prefabValues, TypeTag enclosingType) Changes the field's value to something else.voidchangeField(PrefabValues prefabValues, TypeTag enclosingType, LinkedHashSet<TypeTag> typeStack) Changes the field's value to something else.voidCopies field's value to the corresponding field in the specified object.voidTries to make the field null.voidTries to make the field null.static FieldModifierFactory method.voidTries 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
FieldModifierforfieldinobject.
-
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.
-
changeField
public void changeField(PrefabValues prefabValues, TypeTag enclosingType, LinkedHashSet<TypeTag> typeStack) 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..typeStack- Keeps track of recursion in the type.- Throws:
ReflectionException- If the operation fails.
-