Package de.inetsoftware.classparser
Class MethodInfo
java.lang.Object
de.inetsoftware.classparser.MethodInfo
- All Implemented Interfaces:
Member
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final Attributes
private ClassFile
private Code
private final ConstantPool
private String
private Exceptions
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionMethodInfo
(DataInputStream input, ConstantPool constantPool, ClassFile classFile) Read the method_info structure http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6 http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#1513 -
Method Summary
Modifier and TypeMethodDescriptionint
Get the access flags of the method.getAnnotation
(String annotation) Get a single annotation or nullThe class name of the declaring class like "java/lang/Object".getCode()
Get the constant pool of the the current class.Get the declaring class file of the methodgetName()
The simple name without packageGet the signature of the method with generic types.getType()
Get the signature of the method without generic types.boolean
If the method is abstractboolean
isLambda()
If the method is a synthetic lambda methodboolean
isNative()
If the method is nativeboolean
isStatic()
If the method is a static method.boolean
If the method is synthetic(package private) void
setDeclaringClassFile
(String origClassName, ClassFile classFile) Replace the reference to the ClassFile
-
Field Details
-
accessFlags
private final int accessFlags -
name
-
description
-
attributes
-
constantPool
-
code
-
exceptions
-
classFile
-
annotations
-
-
Constructor Details
-
MethodInfo
MethodInfo(DataInputStream input, ConstantPool constantPool, ClassFile classFile) throws IOException Read the method_info structure http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6 http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#1513- Parameters:
input
- the stream of the class fileconstantPool
- the ConstantPool of the classclassFile
- the declaring class file- Throws:
IOException
- if an I/O error occurs
-
-
Method Details
-
getDeclaringClassFile
Get the declaring class file of the method- Returns:
- the ClassFile
-
getAccessFlags
public int getAccessFlags()Get the access flags of the method. http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6-200-A http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#1522- Returns:
- the flags
-
isStatic
public boolean isStatic()If the method is a static method. http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6-200-A http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#1522- Returns:
- true, if static
- See Also:
-
isNative
public boolean isNative()If the method is native- Returns:
- true, if abstract
-
isAbstract
public boolean isAbstract()If the method is abstract- Returns:
- true, if abstract
-
isSynthetic
public boolean isSynthetic()If the method is synthetic- Returns:
- true, if synthetic
-
isLambda
public boolean isLambda()If the method is a synthetic lambda method- Returns:
- true, if lambda method
-
getName
Description copied from interface:Member
The simple name without package -
getClassName
The class name of the declaring class like "java/lang/Object".- Specified by:
getClassName
in interfaceMember
- Returns:
- the class name
-
getAttributes
- Returns:
- the attributes
-
getCode
- Throws:
IOException
-
getType
Get the signature of the method without generic types. -
getSignature
Get the signature of the method with generic types.- Returns:
- the signature
- Throws:
IOException
- if an I/O error occurs
-
getExceptions
- Throws:
IOException
-
getAnnotation
Get a single annotation or null- Parameters:
annotation
- the class name of the annotation- Returns:
- the value or null if not exists
- Throws:
IOException
- if any I/O error occur
-
getConstantPool
Get the constant pool of the the current class.- Returns:
- the constant pool
-
setDeclaringClassFile
Replace the reference to the ClassFile- Parameters:
origClassName
- the class name that should be replaced.classFile
- the new value
-