Package com.yworks.yshrink.model
Class MethodDescriptor
- java.lang.Object
-
- com.yworks.yshrink.model.AbstractDescriptor
-
- com.yworks.yshrink.model.MethodDescriptor
-
public class MethodDescriptor extends AbstractDescriptor
The type Method descriptor.
-
-
Field Summary
-
Fields inherited from class com.yworks.yshrink.model.AbstractDescriptor
access, node, sourceJar
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodDescriptor(java.lang.String name, int access, java.lang.String desc, java.lang.String[] exceptions, java.io.File sourceJar)Instantiates a new Method descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFieldRef(java.lang.String type, java.lang.String name)Add field ref.voidaddInvocation(int opcode, java.lang.String type, java.lang.String name, java.lang.String desc)Add invocation.voidaddLocalVar(java.lang.String desc)Add local var.voidaddTypeInstruction(int opcode, java.lang.String desc)Add type instruction.intgetAccess()Gets access.java.lang.StringgetArgumentsString()Gets arguments string.org.objectweb.asm.Type[]getArgumentTypes()Get argument types type [ ].java.lang.StringgetDesc()Gets desc.java.lang.String[]getExceptions()Get exceptions string [ ].java.util.List<java.lang.String[]>getFieldRefs()Gets field refs.java.util.List<Invocation>getInvocations()Gets invocations.java.lang.StringgetName()Gets name.org.objectweb.asm.TypegetReturnType()Gets return type.java.lang.StringgetSignature()Gets signature.java.util.List<java.util.AbstractMap.SimpleEntry<java.lang.Object,java.lang.Object>>getTypeInstructions()Gets type instructions.booleanhasFlag(int code)Has flag boolean.booleanisConstructor()Is constructor boolean.booleanisPrivate()Is private boolean.booleanisStatic()Is static boolean.booleanoverrides(MethodDescriptor md)check wether method md could override this method.booleanoverrides(java.lang.reflect.Method m)Overrides boolean.java.lang.StringtoString()-
Methods inherited from class com.yworks.yshrink.model.AbstractDescriptor
addAnnotation, getAnnotations, getNode, getSourceJar, isAbstract, isEntryPoint, isSynthetic, setEntryPoint, setNode, setReachable
-
-
-
-
Constructor Detail
-
MethodDescriptor
protected MethodDescriptor(java.lang.String name, int access, java.lang.String desc, java.lang.String[] exceptions, java.io.File sourceJar)Instantiates a new Method descriptor.- Parameters:
name- the nameaccess- the accessdesc- the descexceptions- the exceptionssourceJar- the source jar
-
-
Method Detail
-
getName
public java.lang.String getName()
Gets name.- Returns:
- the name
-
getDesc
public java.lang.String getDesc()
Gets desc.- Returns:
- the desc
-
getArgumentTypes
public org.objectweb.asm.Type[] getArgumentTypes()
Get argument types type [ ].- Returns:
- the type [ ]
-
getArgumentsString
public java.lang.String getArgumentsString()
Gets arguments string.- Returns:
- the arguments string
-
getReturnType
public org.objectweb.asm.Type getReturnType()
Gets return type.- Returns:
- the return type
-
getInvocations
public java.util.List<Invocation> getInvocations()
Gets invocations.- Returns:
- the invocations
-
addInvocation
public void addInvocation(int opcode, java.lang.String type, java.lang.String name, java.lang.String desc)Add invocation.- Parameters:
opcode- the opcodetype- the typename- the namedesc- the desc
-
getFieldRefs
public java.util.List<java.lang.String[]> getFieldRefs()
Gets field refs.- Returns:
- the field refs
-
addFieldRef
public void addFieldRef(java.lang.String type, java.lang.String name)Add field ref.- Parameters:
type- the typename- the name
-
addTypeInstruction
public void addTypeInstruction(int opcode, java.lang.String desc)Add type instruction.- Parameters:
opcode- the opcodedesc- the desc
-
addLocalVar
public void addLocalVar(java.lang.String desc)
Add local var.- Parameters:
desc- the desc
-
getTypeInstructions
public java.util.List<java.util.AbstractMap.SimpleEntry<java.lang.Object,java.lang.Object>> getTypeInstructions()
Gets type instructions.- Returns:
- the type instructions
-
getExceptions
public java.lang.String[] getExceptions()
Get exceptions string [ ].- Returns:
- the string [ ]
-
hasFlag
public boolean hasFlag(int code)
Has flag boolean.- Parameters:
code- the code- Returns:
- the boolean
-
isStatic
public boolean isStatic()
Is static boolean.- Returns:
- the boolean
-
isPrivate
public boolean isPrivate()
Is private boolean.- Returns:
- the boolean
-
getAccess
public int getAccess()
Description copied from class:AbstractDescriptorGets access.- Overrides:
getAccessin classAbstractDescriptor- Returns:
- the access
-
overrides
public boolean overrides(MethodDescriptor md)
check wether method md could override this method.- same name
mdhas same return type or return type ofmdis subclass of the return type of this method.- same number and type of arguments
- md throws only the same or subclasses of Exceptions listed in the throws clause of this method
- access: same or more
- Parameters:
md- the MethodDescriptor- Returns:
- true iff all constraints given above are true
-
overrides
public boolean overrides(java.lang.reflect.Method m)
Overrides boolean.- Parameters:
m- the m- Returns:
- the boolean
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isConstructor
public boolean isConstructor()
Is constructor boolean.- Returns:
- the boolean
-
getSignature
public java.lang.String getSignature()
Gets signature.- Returns:
- the signature
-
-