|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.jqno.equalsverifier.util.ObjectAccessor<T>
T
- The specified object's class.public class ObjectAccessor<T>
Wraps an object to provide reflective access to it. ObjectAccessor can copy and scramble the wrapped object.
Method Summary | ||
---|---|---|
T |
copy()
Creates a copy of the wrapped object. |
|
T |
copyIntoAnonymousSubclass()
Creates a copy of the wrapped object, where the copy type is an anonymous subclass of the wrapped object's class. |
|
|
copyIntoSubclass(Class<S> subclass)
Creates a copy of the wrapped object, where the copy's type is a specified subclass of the wrapped object's class. |
|
FieldAccessor |
fieldAccessorFor(Field field)
Returns a FieldAccessor for the wrapped object and the specified field. |
|
T |
get()
Returns the wrapped object. |
|
static
|
of(T object)
Factory method. |
|
static
|
of(T object,
Class<T> type)
Factory method. |
|
void |
scramble(PrefabValues prefabValues)
Modifies all fields of the wrapped object that are declared in T and in its superclasses. |
|
void |
shallowScramble(PrefabValues prefabValues)
Modifies all fields of the wrapped object that are declared in T, but not those inherited from superclasses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> ObjectAccessor<T> of(T object)
T
- object
's type.object
- The object to wrap.
ObjectAccessor
for object
.public static <T> ObjectAccessor<T> of(T object, Class<T> type)
T
- object
's type, or a supertype.object
- The object to wrap.type
- Superclass of object
's type, as which it will be
treated by ObjectAccessor
.
ObjectAccessor
for object
.public T get()
public FieldAccessor fieldAccessorFor(Field field)
field
- A field in T.
public T copy()
public <S extends T> S copyIntoSubclass(Class<S> subclass)
subclass
- A subclass of the wrapped object's class.
public T copyIntoAnonymousSubclass()
public void scramble(PrefabValues prefabValues)
prefabValues
- Prefabricated values to take values from.public void shallowScramble(PrefabValues prefabValues)
prefabValues
- Prefabricated values to take values from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |