Package de.inetsoftware.classparser
Class MethodInfo
- java.lang.Object
-
- de.inetsoftware.classparser.MethodInfo
-
-
Field Summary
Fields Modifier and Type Field Description private int
accessFlags
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>
annotations
private Attributes
attributes
private ClassFile
classFile
private Code
code
private ConstantPool
constantPool
private java.lang.String
description
private Exceptions
exceptions
private java.lang.String
name
-
Constructor Summary
Constructors Constructor Description MethodInfo(java.io.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAccessFlags()
Get the access flags of the method.java.util.Map<java.lang.String,java.lang.Object>
getAnnotation(java.lang.String annotation)
Get a single annotation or nullAttributes
getAttributes()
java.lang.String
getClassName()
The class name of the declaring class like "java/lang/Object".Code
getCode()
ConstantPool
getConstantPool()
Get the constant pool of the the current class.ClassFile
getDeclaringClassFile()
Get the declaring class file of the methodExceptions
getExceptions()
java.lang.String
getName()
The simple name without packagejava.lang.String
getSignature()
Get the signature of the method with generic types.java.lang.String
getType()
Get the signature of the method without generic types.boolean
isAbstract()
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
isSynthetic()
If the method is synthetic(package private) void
setDeclaringClassFile(java.lang.String origClassName, ClassFile classFile)
Replace the reference to the ClassFile
-
-
-
Field Detail
-
accessFlags
private final int accessFlags
-
name
private final java.lang.String name
-
description
private java.lang.String description
-
attributes
private final Attributes attributes
-
constantPool
private final ConstantPool constantPool
-
code
private Code code
-
exceptions
private Exceptions exceptions
-
classFile
private ClassFile classFile
-
annotations
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> annotations
-
-
Constructor Detail
-
MethodInfo
MethodInfo(java.io.DataInputStream input, ConstantPool constantPool, ClassFile classFile) throws java.io.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:
java.io.IOException
- if an I/O error occurs
-
-
Method Detail
-
getDeclaringClassFile
public ClassFile 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:
getAccessFlags()
-
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
public java.lang.String getName()
Description copied from interface:Member
The simple name without package
-
getClassName
public java.lang.String getClassName()
The class name of the declaring class like "java/lang/Object".- Specified by:
getClassName
in interfaceMember
- Returns:
- the class name
-
getAttributes
public Attributes getAttributes()
- Returns:
- the attributes
-
getCode
public Code getCode() throws java.io.IOException
- Throws:
java.io.IOException
-
getType
public java.lang.String getType()
Get the signature of the method without generic types.
-
getSignature
public java.lang.String getSignature() throws java.io.IOException
Get the signature of the method with generic types.- Returns:
- the signature
- Throws:
java.io.IOException
- if an I/O error occurs
-
getExceptions
public Exceptions getExceptions() throws java.io.IOException
- Throws:
java.io.IOException
-
getAnnotation
@Nullable public java.util.Map<java.lang.String,java.lang.Object> getAnnotation(java.lang.String annotation) throws java.io.IOException
Get a single annotation or null- Parameters:
annotation
- the class name of the annotation- Returns:
- the value or null if not exists
- Throws:
java.io.IOException
- if any I/O error occur
-
getConstantPool
public ConstantPool getConstantPool()
Get the constant pool of the the current class.- Returns:
- the constant pool
-
setDeclaringClassFile
void setDeclaringClassFile(@Nonnull java.lang.String origClassName, @Nonnull ClassFile classFile)
Replace the reference to the ClassFile- Parameters:
origClassName
- the class name that should be replaced.classFile
- the new value
-
-