public final class FieldInfo extends java.lang.Object implements AnnotationTarget
Thread-Safety
This class is immutable and can be shared between threads without safe publication.AnnotationTarget.Kind| Modifier and Type | Field and Description |
|---|---|
private ClassInfo |
clazz |
private FieldInternal |
internal |
| Constructor and Description |
|---|
FieldInfo() |
FieldInfo(ClassInfo clazz,
byte[] name,
Type type,
short flags) |
FieldInfo(ClassInfo clazz,
FieldInternal internal) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<AnnotationInstance> |
annotations()
Returns the list of annotation instances declared on this field.
|
ClassInfo |
asClass()
Casts and returns this target as a
ClassInfo if it is of kind CLASS |
FieldInfo |
asField()
Casts and returns this target as a
FieldInfo if it is of kind FIELD |
MethodInfo |
asMethod()
Casts and returns this target as a
MethodInfo if it is of kind METHOD |
MethodParameterInfo |
asMethodParameter()
Casts and returns this target as a
MethodParameterInfo if it is of kind METHOD_PARAMETER |
TypeTarget |
asType()
Casts and returns this target as a
TypeTarget if it is of kind TYPE |
static FieldInfo |
create(ClassInfo clazz,
java.lang.String name,
Type type,
short flags)
Construct a new mock Field instance.
|
ClassInfo |
declaringClass()
Returns the class which declared the field
|
(package private) FieldInternal |
fieldInternal() |
short |
flags()
Returns the access fields of this field.
|
AnnotationTarget.Kind |
kind()
Returns the kind of object this target represents.
|
java.lang.String |
name()
Returns the local name of the field
|
(package private) void |
setAnnotations(java.util.List<AnnotationInstance> annotations) |
(package private) void |
setClassInfo(ClassInfo clazz) |
(package private) void |
setFieldInternal(FieldInternal internal) |
(package private) void |
setType(Type type) |
java.lang.String |
toString()
Returns a string representation describing this field.
|
Type |
type()
Returns the
Type declared on this field. |
private ClassInfo clazz
private FieldInternal internal
FieldInfo()
FieldInfo(ClassInfo clazz, FieldInternal internal)
public static FieldInfo create(ClassInfo clazz, java.lang.String name, Type type, short flags)
clazz - the class declaring the fieldname - the name of the fieldtype - the Java field typeflags - the field attributespublic final java.lang.String name()
public final ClassInfo declaringClass()
public final Type type()
Type declared on this field. This may be an array, a primitive, or a generic
type definition.public final AnnotationTarget.Kind kind()
AnnotationTargetkind in interface AnnotationTargetpublic java.util.List<AnnotationInstance> annotations()
public final short flags()
Modifier can be used on this value.public java.lang.String toString()
toString in class java.lang.Objectpublic final ClassInfo asClass()
AnnotationTargetClassInfo if it is of kind CLASSasClass in interface AnnotationTargetpublic final FieldInfo asField()
AnnotationTargetFieldInfo if it is of kind FIELDasField in interface AnnotationTargetpublic final MethodInfo asMethod()
AnnotationTargetMethodInfo if it is of kind METHODasMethod in interface AnnotationTargetpublic final MethodParameterInfo asMethodParameter()
AnnotationTargetMethodParameterInfo if it is of kind METHOD_PARAMETERasMethodParameter in interface AnnotationTargetpublic final TypeTarget asType()
AnnotationTargetTypeTarget if it is of kind TYPEasType in interface AnnotationTargetvoid setType(Type type)
void setAnnotations(java.util.List<AnnotationInstance> annotations)
FieldInternal fieldInternal()
void setFieldInternal(FieldInternal internal)
void setClassInfo(ClassInfo clazz)