Modifier and Type | Field and Description |
---|---|
java.lang.reflect.Field |
field |
Constructor and Description |
---|
JvmField(java.lang.reflect.Field field) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.Object instance)
Returns the current value of the field for a given instance
|
Annotation |
getDeclaredAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns a annotation on this field
|
Annotation[] |
getDeclaredAnnotations()
Returns the declared annotations
|
java.lang.Class |
getElementType(int index)
Returns the class of the generic type parameter at the specific index
|
java.lang.String |
getName()
Returns the name of the field
|
java.lang.Class |
getType()
Returns the class type this field was declared as
|
boolean |
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Returns true if the field if annotated with the given annotation class
|
boolean |
isDefaultAccess()
Returns if the field is not public/private/protected
|
boolean |
isFinal()
Returns if the field is declared as final
|
boolean |
isPrivate()
Returns if the field is private
|
boolean |
isProtected()
Returns if the field is protected
|
boolean |
isPublic()
Returns if the field is public
|
boolean |
isStatic()
Returns if the field is static
|
boolean |
isSynthetic()
Returns if the field is synthetic (generated by compiler)
|
boolean |
isTransient()
Returns if the field is declared transient
|
boolean |
isVolatile()
Returns if the field is declared volatile
|
void |
set(java.lang.Object instance,
java.lang.Object value)
Sets the current value of the field for a given instance
|
public java.lang.String getName()
Field
public java.lang.Object get(java.lang.Object instance) throws ReflectionException
Field
get
in interface Field
instance
- The instance to get the field's value fromReflectionException
public void set(java.lang.Object instance, java.lang.Object value) throws ReflectionException
Field
set
in interface Field
instance
- The instance to set the field's value forvalue
- The new valueReflectionException
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Field
isAnnotationPresent
in interface Field
annotation
- The annotation classpublic Annotation[] getDeclaredAnnotations()
Field
getDeclaredAnnotations
in interface Field
public Annotation getDeclaredAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Field
getDeclaredAnnotation
in interface Field
annotationType
- The annotation type to search forpublic java.lang.Class getType()
Field
public java.lang.Class getElementType(int index)
Field
getElementType
in interface Field
index
- The generic parameter indexpublic boolean isDefaultAccess()
Field
isDefaultAccess
in interface Field
public boolean isFinal()
Field
public boolean isPrivate()
Field
public boolean isProtected()
Field
isProtected
in interface Field
public boolean isPublic()
Field
public boolean isStatic()
Field
public boolean isTransient()
Field
isTransient
in interface Field
public boolean isVolatile()
Field
isVolatile
in interface Field
public boolean isSynthetic()
Field
isSynthetic
in interface Field