public class FieldWrapper
extends java.lang.Object
Field class for easy access to all required methods.| Constructor and Description |
|---|
FieldWrapper(FieldStream parent,
java.lang.reflect.Field field) |
| Modifier and Type | Method and Description |
|---|---|
java.util.stream.Stream<java.lang.annotation.Annotation> |
annotations() |
void |
copy(java.lang.Object target)
Copy the value of the
Field to the given target. |
void |
copy(java.lang.Object instance,
java.lang.Object target)
Copy the value of the
Field to the given target with the given owner. |
boolean |
equals(java.lang.Object obj) |
java.lang.reflect.Type[] |
genericTypes() |
<T> T |
get()
Get the value of the field.
|
<T> T |
get(java.lang.Object instance)
Get the value of the field with the given instance.
|
int |
hashCode() |
ModifierWrapper |
modifier() |
java.lang.String |
name() |
java.lang.Class<?> |
owner() |
FieldStream |
parent() |
java.lang.reflect.Field |
raw() |
void |
set(java.lang.Object value)
Set the value of the
Field. |
void |
set(java.lang.Object instance,
java.lang.Object value)
Set the value of the
Field with the given owner. |
RStream |
stream()
Get the value of the field and wrap it in a new
RStream. |
RStream |
stream(java.lang.Class<?> clazz)
Get the value of the field and wrap it in a new
RStream. |
RStream |
stream(java.lang.Class<?> clazz,
java.lang.Object instance)
Get the value of the field with the given instance and wrap it in a new
RStream. |
RStream |
stream(java.lang.Object instance)
Get the value of the field with the given instance and wrap it in a new
RStream. |
java.lang.String |
toString() |
java.lang.Class<?> |
type() |
public FieldWrapper(FieldStream parent, java.lang.reflect.Field field)
public FieldStream parent()
public java.lang.reflect.Field raw()
public java.lang.String name()
public java.lang.Class<?> type()
public java.lang.Class<?> owner()
public ModifierWrapper modifier()
ModifierWrapper of the fieldpublic java.lang.reflect.Type[] genericTypes()
public java.util.stream.Stream<java.lang.annotation.Annotation> annotations()
public <T> T get()
T - The type of the fieldjava.lang.IllegalStateException - If the field is not static and no instance is cachedpublic RStream stream()
RStream.java.lang.IllegalStateException - If the field is not static and no instance is cachedpublic RStream stream(java.lang.Class<?> clazz)
RStream.clazz - The class used for the streamjava.lang.IllegalStateException - If the field is not static and no instance is cachedpublic <T> T get(java.lang.Object instance)
T - The type of the fieldinstance - The instance of the ownerpublic RStream stream(java.lang.Object instance)
RStream.instance - The instance of the ownerpublic RStream stream(java.lang.Class<?> clazz, java.lang.Object instance)
RStream.clazz - The class used for the streaminstance - The instance of the ownerpublic void set(java.lang.Object value)
Field.value - The value to set the Field tojava.lang.IllegalStateException - If trying to set a non-static Field if no instance is providedpublic void set(java.lang.Object instance,
java.lang.Object value)
Field with the given owner.instance - The instance of the ownervalue - The value to set the Field topublic void copy(java.lang.Object target)
Field to the given target.target - The target to copy the value topublic void copy(java.lang.Object instance,
java.lang.Object target)
Field to the given target with the given owner.instance - The instance of the ownertarget - The target to copy the value topublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object