Package serp.bytecode
Class Annotation.Property
- java.lang.Object
-
- serp.bytecode.Annotation.Property
-
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
- Enclosing class:
- Annotation
public static class Annotation.Property extends java.lang.Object implements BCEntity, VisitAcceptor
An annotation property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Annotation.Property.Value
Property value struct.
-
Field Summary
Fields Modifier and Type Field Description private int
_nameIndex
private Annotation
_owner
private Annotation.Property.Value
_value
private Annotation.Property.Value[]
_values
-
Constructor Summary
Constructors Constructor Description Property(Annotation owner)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisit(BCVisitor visit)
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.Annotation
getAnnotation()
The owning annotation.Annotation
getAnnotationValue()
Return the annotation value of this property, or null if not set.boolean
getBooleanValue()
Return the boolean value of this property, or false if not set.byte
getByteValue()
Return the byte value of this property, or false if not set.java.lang.ClassLoader
getClassLoader()
Return the class loader to use when loading related classes.java.lang.String
getClassNameValue()
Return the class value of this property, or null if not set.double
getDoubleValue()
Return the double value of this property, or 0 if not set.private static java.lang.String
getEnumName(java.lang.Object o)
Return the name of this enum value, or null if not an enum.float
getFloatValue()
Return the float value of this property, or 0 if not set.int
getIntValue()
Return the int value of this property, or 0 if not set.(package private) int
getLength()
private int
getLength(Annotation.Property.Value val)
Return the length of the given value.long
getLongValue()
Return the long value of this property, or 0 if not set.java.lang.String
getName()
Return the name of this property.int
getNameIndex()
Return the index in the classConstantPool
of theUTF8Entry
holding the name of this property.ConstantPool
getPool()
Return the constant pool of the current class.Project
getProject()
Return the project of the current class.short
getShortValue()
Return the short value of this property, or 0 if not set.java.lang.String
getStringValue()
Return the string value of this property, or null if not set.java.lang.Object
getValue()
Return the value of the property as its wrapper type.private java.lang.Object
getValue(Annotation.Property.Value val)
Extract the Java value.(package private) void
invalidate()
boolean
isValid()
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.Annotation[]
newAnnotationArrayValue(java.lang.Class type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.Annotation[]
newAnnotationArrayValue(java.lang.String type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.Annotation[]
newAnnotationArrayValue(BCClass type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.Annotation
newAnnotationValue(java.lang.Class type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.Annotation
newAnnotationValue(java.lang.String type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.Annotation
newAnnotationValue(BCClass type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.(package private) void
read(java.io.DataInput in)
private void
read(Annotation.Property.Value val, int tag, java.io.DataInput in)
Read data into the given value.void
setClassNameValue(java.lang.String value)
Set the class value of this property.private void
setClassNameValue(Annotation.Property.Value val, java.lang.String o)
Set the class value of this property.void
setName(java.lang.String name)
Set the name of this property.void
setNameIndex(int index)
Set the index in the classConstantPool
of theUTF8Entry
holding the name of this property.void
setValue(boolean value)
Set the boolean value of this property.void
setValue(byte value)
Set the byte value of this property.void
setValue(double value)
Set the double value of this property.void
setValue(float value)
Set the float value of this property.void
setValue(int value)
Set the int value of this property.void
setValue(long value)
Set the long value of this property.void
setValue(short value)
Set the short value of this property.void
setValue(java.lang.Class value)
Set the class value of this property.void
setValue(java.lang.Object value)
Set value of this property.void
setValue(java.lang.String value)
Set the string value of this property.Annotation
setValue(Annotation value)
Set the annotation value of this property by importing the given annotation from another instance.private void
setValue(Annotation.Property.Value val, boolean o)
Set the boolean value of this property.private void
setValue(Annotation.Property.Value val, byte o)
Set the byte value of this property.private void
setValue(Annotation.Property.Value val, double o)
Set the double value of this property.private void
setValue(Annotation.Property.Value val, float o)
Set the float value of this property.private void
setValue(Annotation.Property.Value val, int o)
Set the int value of this property.private void
setValue(Annotation.Property.Value val, long o)
Set the long value of this property.private void
setValue(Annotation.Property.Value val, short o)
Set the short value of this property.private void
setValue(Annotation.Property.Value val, java.lang.Object o)
Set the given value.private void
setValue(Annotation.Property.Value val, java.lang.String o)
Set the string value of this property.private Annotation
setValue(Annotation.Property.Value val, Annotation o)
Set the annotation value of this property by importing the given annotation from another instance.Annotation[]
setValue(Annotation[] value)
Set the annotation value of this property by importing the given annotation from another instance.void
setValue(BCClass value)
Set the class value of this property.(package private) void
write(java.io.DataOutput out)
private void
write(Annotation.Property.Value val, java.io.DataOutput out)
Write the data for the given value to the stream.
-
-
-
Field Detail
-
_owner
private Annotation _owner
-
_nameIndex
private int _nameIndex
-
_value
private final Annotation.Property.Value _value
-
_values
private Annotation.Property.Value[] _values
-
-
Constructor Detail
-
Property
Property(Annotation owner)
-
-
Method Detail
-
getAnnotation
public Annotation getAnnotation()
The owning annotation.
-
invalidate
void invalidate()
-
getNameIndex
public int getNameIndex()
Return the index in the classConstantPool
of theUTF8Entry
holding the name of this property.
-
setNameIndex
public void setNameIndex(int index)
Set the index in the classConstantPool
of theUTF8Entry
holding the name of this property.
-
getName
public java.lang.String getName()
Return the name of this property.
-
setName
public void setName(java.lang.String name)
Set the name of this property.
-
getValue
public java.lang.Object getValue()
Return the value of the property as its wrapper type. Returns class values as the class name.
-
getValue
private java.lang.Object getValue(Annotation.Property.Value val)
Extract the Java value.
-
setValue
public void setValue(java.lang.Object value)
Set value of this property. The value should be an instance of any primitive wrapper type, String, Class, BCClass, an enum constant, an annotation, or an array of any of these types.
-
setValue
private void setValue(Annotation.Property.Value val, java.lang.Object o)
Set the given value.
-
getEnumName
private static java.lang.String getEnumName(java.lang.Object o)
Return the name of this enum value, or null if not an enum.
-
getStringValue
public java.lang.String getStringValue()
Return the string value of this property, or null if not set.
-
getBooleanValue
public boolean getBooleanValue()
Return the boolean value of this property, or false if not set.
-
getByteValue
public byte getByteValue()
Return the byte value of this property, or false if not set.
-
getIntValue
public int getIntValue()
Return the int value of this property, or 0 if not set.
-
getLongValue
public long getLongValue()
Return the long value of this property, or 0 if not set.
-
getFloatValue
public float getFloatValue()
Return the float value of this property, or 0 if not set.
-
getDoubleValue
public double getDoubleValue()
Return the double value of this property, or 0 if not set.
-
getShortValue
public short getShortValue()
Return the short value of this property, or 0 if not set.
-
getClassNameValue
public java.lang.String getClassNameValue()
Return the class value of this property, or null if not set.
-
getAnnotationValue
public Annotation getAnnotationValue()
Return the annotation value of this property, or null if not set.
-
setValue
public void setValue(java.lang.String value)
Set the string value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, java.lang.String o)
Set the string value of this property.
-
setValue
public void setValue(boolean value)
Set the boolean value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, boolean o)
Set the boolean value of this property.
-
setValue
public void setValue(byte value)
Set the byte value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, byte o)
Set the byte value of this property.
-
setValue
public void setValue(int value)
Set the int value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, int o)
Set the int value of this property.
-
setValue
public void setValue(long value)
Set the long value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, long o)
Set the long value of this property.
-
setValue
public void setValue(float value)
Set the float value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, float o)
Set the float value of this property.
-
setValue
public void setValue(double value)
Set the double value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, double o)
Set the double value of this property.
-
setValue
public void setValue(short value)
Set the short value of this property.
-
setValue
private void setValue(Annotation.Property.Value val, short o)
Set the short value of this property.
-
setValue
public void setValue(java.lang.Class value)
Set the class value of this property.
-
setValue
public void setValue(BCClass value)
Set the class value of this property.
-
setClassNameValue
public void setClassNameValue(java.lang.String value)
Set the class value of this property.
-
setClassNameValue
private void setClassNameValue(Annotation.Property.Value val, java.lang.String o)
Set the class value of this property.
-
setValue
public Annotation setValue(Annotation value)
Set the annotation value of this property by importing the given annotation from another instance.
-
setValue
private Annotation setValue(Annotation.Property.Value val, Annotation o)
Set the annotation value of this property by importing the given annotation from another instance.
-
setValue
public Annotation[] setValue(Annotation[] value)
Set the annotation value of this property by importing the given annotation from another instance.
-
newAnnotationValue
public Annotation newAnnotationValue(java.lang.Class type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.
-
newAnnotationValue
public Annotation newAnnotationValue(BCClass type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.
-
newAnnotationValue
public Annotation newAnnotationValue(java.lang.String type)
Set this property value to a new annotation of the given type, returning the annotation for manipulation.
-
newAnnotationArrayValue
public Annotation[] newAnnotationArrayValue(java.lang.Class type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.
-
newAnnotationArrayValue
public Annotation[] newAnnotationArrayValue(BCClass type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.
-
newAnnotationArrayValue
public Annotation[] newAnnotationArrayValue(java.lang.String type, int length)
Set this property value to a new annotation array of the given type and length, returning the annotations for manipulation.
-
getProject
public Project getProject()
Description copied from interface:BCEntity
Return the project of the current class.- Specified by:
getProject
in interfaceBCEntity
-
getPool
public ConstantPool getPool()
Description copied from interface:BCEntity
Return the constant pool of the current class.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:BCEntity
Return the class loader to use when loading related classes.- Specified by:
getClassLoader
in interfaceBCEntity
-
isValid
public boolean isValid()
Description copied from interface:BCEntity
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptor
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.- Specified by:
acceptVisit
in interfaceVisitAcceptor
-
getLength
int getLength()
-
getLength
private int getLength(Annotation.Property.Value val)
Return the length of the given value.
-
read
void read(java.io.DataInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
read
private void read(Annotation.Property.Value val, int tag, java.io.DataInput in) throws java.io.IOException
Read data into the given value.- Throws:
java.io.IOException
-
write
void write(java.io.DataOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
write
private void write(Annotation.Property.Value val, java.io.DataOutput out) throws java.io.IOException
Write the data for the given value to the stream.- Throws:
java.io.IOException
-
-