Package org.biojava.utils.bytecode
Class GeneratedCodeMethod
java.lang.Object
org.biojava.utils.bytecode.GeneratedCodeMethod
- All Implemented Interfaces:
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
Modifier and TypeMethodDescriptionvoidAdds a feature to the ThrownException attribute of the GeneratedCodeMethod objectThe class that contains this methodA human-readable description of the classThe fully qualified name for this classintGet the modifiers, such as PUBLIC, ABSTRACT and so ongetName()The name of the method.getParameterType(int pos) Get the type of the parameter at a given positionGet the return typegetThis()Gets the This attribute of the GeneratedCodeMethod objectGets the ThrownExceptions attribute of the GeneratedCodeMethod objectgetVariable(int pos) Gets the Variable attribute of the GeneratedCodeMethod object.getVariable(String argName) Gets the Variable attribute of the GenerateCodeMethod object by name.intGet the number of parameters taken by this method
-
Method Details
-
getName
Description copied from interface:CodeMethodThe name of the method.- Specified by:
getNamein interfaceCodeMethod- Returns:
- the method name
-
getFullName
Description copied from interface:CodeMethodThe fully qualified name for this class- Specified by:
getFullNamein interfaceCodeMethod- Returns:
- the full name
-
getContainingClass
Description copied from interface:CodeMethodThe class that contains this method- Specified by:
getContainingClassin interfaceCodeMethod- Returns:
- the containing class
-
getDescriptor
Description copied from interface:CodeMethodA human-readable description of the class- Specified by:
getDescriptorin interfaceCodeMethod- Returns:
- the class description
-
getModifiers
public int getModifiers()Description copied from interface:CodeMethodGet the modifiers, such as PUBLIC, ABSTRACT and so on- Specified by:
getModifiersin interfaceCodeMethod- Returns:
- the class modifiers
-
getReturnType
Description copied from interface:CodeMethodGet the return type- Specified by:
getReturnTypein interfaceCodeMethod- Returns:
- the return type
-
numParameters
public int numParameters()Description copied from interface:CodeMethodGet the number of parameters taken by this method- Specified by:
numParametersin interfaceCodeMethod- Returns:
- the number of parameters
-
getParameterType
Description copied from interface:CodeMethodGet the type of the parameter at a given position- Specified by:
getParameterTypein interfaceCodeMethod- Parameters:
pos- the position to fetch the parameter type for- Returns:
- the type of the parameter at that position
-
getVariable
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
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:
NoSuchElementException- if there is no local with that name
-
getThis
Gets the This attribute of the GeneratedCodeMethod object- Returns:
- The This value
-
getThrownExceptions
Gets the ThrownExceptions attribute of the GeneratedCodeMethod object- Returns:
- The ThrownExceptions value
-
addThrownException
Adds a feature to the ThrownException attribute of the GeneratedCodeMethod object- Parameters:
cc- The feature to be added to the ThrownException attribute
-