Package org.codehaus.janino.util
Class ClassFile.MethodInfo
java.lang.Object
org.codehaus.janino.util.ClassFile.MethodInfo
- All Implemented Interfaces:
Annotatable
- Enclosing class:
- ClassFile
Representation of a "method_info" structure, as defined by JVMS7 4.6.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final short
private final List<ClassFile.AttributeInfo>
private final short
private final short
-
Constructor Summary
ConstructorsConstructorDescriptionMethodInfo
(short accessFlags, short nameIndex, short descriptorIndex, List<ClassFile.AttributeInfo> attributes) Initializes the "method_info" structure. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotationsAttributeEntry
(boolean runtimeVisible, String fieldDescriptor, Map<Short, ClassFile.ElementValue> elementValuePairs) Adds a "Runtime[In]visibleAnnotations" attribute tothis
object (if that annotation does not yet exist) and adds an entry to it.void
addAttribute
(ClassFile.AttributeInfo attribute) Adds the attribute to this method.short
getAnnotations
(boolean runtimeVisible) getName()
void
store
(DataOutputStream dos) Writes this object to aDataOutputStream
, in the format described inJVMS7 4.6.toString()
-
Field Details
-
accessFlags
private final short accessFlags -
nameIndex
private final short nameIndex -
descriptorIndex
private final short descriptorIndex -
attributes
-
-
Constructor Details
-
MethodInfo
public MethodInfo(short accessFlags, short nameIndex, short descriptorIndex, List<ClassFile.AttributeInfo> attributes) Initializes the "method_info" structure.
-
-
Method Details
-
getClassFile
- Returns:
- The
ClassFile
that contains thisClassFile.MethodInfo
object
-
getAccessFlags
public short getAccessFlags()- Returns:
- The access flags of this method; or'ed values are the constants declared in
Mod
.
-
getAnnotations
- Specified by:
getAnnotations
in interfaceAnnotatable
- Returns:
- The annotations of this method
-
getName
- Returns:
- The method's name
-
getDescriptor
- Returns:
- The method descriptor describing this method
-
getAttributes
- Returns:
- The attributes of this method
-
addAttribute
Adds the attribute to this method. -
addAnnotationsAttributeEntry
public void addAnnotationsAttributeEntry(boolean runtimeVisible, String fieldDescriptor, Map<Short, ClassFile.ElementValue> elementValuePairs) Description copied from interface:Annotatable
Adds a "Runtime[In]visibleAnnotations" attribute tothis
object (if that annotation does not yet exist) and adds an entry to it.- Specified by:
addAnnotationsAttributeEntry
in interfaceAnnotatable
elementValuePairs
- Maps "elemant_name_index" (ClassFile.ConstantUtf8Info
) to "element_value", see JVMS8 4.7.16
-
store
Writes this object to aDataOutputStream
, in the format described inJVMS7 4.6.- Throws:
IOException
-
toString
-