Package org.biojava.utils.bytecode
Class GeneratedCodeMethod
- java.lang.Object
-
- org.biojava.utils.bytecode.GeneratedCodeMethod
-
- All Implemented Interfaces:
CodeMethod
public final class GeneratedCodeMethod extends java.lang.Object implements CodeMethod
A method that will be generated.These are instantiated by factory methods on
GeneratedCodeClass
, and can not be instantiated directly.- Author:
- Thomas Down, Matthew Pocock
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addThrownException(CodeClass cc)
Adds a feature to the ThrownException attribute of the GeneratedCodeMethod objectCodeClass
getContainingClass()
The class that contains this methodjava.lang.String
getDescriptor()
A human-readable description of the classjava.lang.String
getFullName()
The fully qualified name for this classint
getModifiers()
Get the modifiers, such as PUBLIC, ABSTRACT and so onjava.lang.String
getName()
The name of the method.CodeClass
getParameterType(int pos)
Get the type of the parameter at a given positionCodeClass
getReturnType()
Get the return typeLocalVariable
getThis()
Gets the This attribute of the GeneratedCodeMethod objectjava.util.Set
getThrownExceptions()
Gets the ThrownExceptions attribute of the GeneratedCodeMethod objectLocalVariable
getVariable(int pos)
Gets the Variable attribute of the GeneratedCodeMethod object.LocalVariable
getVariable(java.lang.String argName)
Gets the Variable attribute of the GenerateCodeMethod object by name.int
numParameters()
Get the number of parameters taken by this method
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:CodeMethod
The name of the method.- Specified by:
getName
in interfaceCodeMethod
- Returns:
- the method name
-
getFullName
public java.lang.String getFullName()
Description copied from interface:CodeMethod
The fully qualified name for this class- Specified by:
getFullName
in interfaceCodeMethod
- Returns:
- the full name
-
getContainingClass
public CodeClass getContainingClass()
Description copied from interface:CodeMethod
The class that contains this method- Specified by:
getContainingClass
in interfaceCodeMethod
- Returns:
- the containing class
-
getDescriptor
public java.lang.String getDescriptor()
Description copied from interface:CodeMethod
A human-readable description of the class- Specified by:
getDescriptor
in interfaceCodeMethod
- Returns:
- the class description
-
getModifiers
public int getModifiers()
Description copied from interface:CodeMethod
Get the modifiers, such as PUBLIC, ABSTRACT and so on- Specified by:
getModifiers
in interfaceCodeMethod
- Returns:
- the class modifiers
-
getReturnType
public CodeClass getReturnType()
Description copied from interface:CodeMethod
Get the return type- Specified by:
getReturnType
in interfaceCodeMethod
- Returns:
- the return type
-
numParameters
public int numParameters()
Description copied from interface:CodeMethod
Get the number of parameters taken by this method- Specified by:
numParameters
in interfaceCodeMethod
- Returns:
- the number of parameters
-
getParameterType
public CodeClass getParameterType(int pos)
Description copied from interface:CodeMethod
Get the type of the parameter at a given position- Specified by:
getParameterType
in interfaceCodeMethod
- Parameters:
pos
- the position to fetch the parameter type for- Returns:
- the type of the parameter at that position
-
getVariable
public LocalVariable getVariable(int pos)
Gets the Variable attribute of the GeneratedCodeMethod object.There is one local variable for each of the arguments of the method, indexed from 0.
- Parameters:
pos
- the index of the local variable- Returns:
- the local variable
-
getVariable
public LocalVariable getVariable(java.lang.String argName) throws java.util.NoSuchElementException
Gets the Variable attribute of the GenerateCodeMethod object by name.All methods have a variable under the string "this". If it was constructed with a String [] naming the args, the locals for each local can be retrieved by name.
- Parameters:
argName
- a String naming the local- Returns:
- the LocalVariable for that argName
- Throws:
java.util.NoSuchElementException
- if there is no local with that name
-
getThis
public LocalVariable getThis()
Gets the This attribute of the GeneratedCodeMethod object- Returns:
- The This value
-
getThrownExceptions
public java.util.Set getThrownExceptions()
Gets the ThrownExceptions attribute of the GeneratedCodeMethod object- Returns:
- The ThrownExceptions value
-
addThrownException
public void addThrownException(CodeClass cc)
Adds a feature to the ThrownException attribute of the GeneratedCodeMethod object- Parameters:
cc
- The feature to be added to the ThrownException attribute
-
-