Package org.biojava.utils.bytecode
Class IntrospectedCodeClass
java.lang.Object
org.biojava.utils.bytecode.IntrospectedCodeClass
- All Implemented Interfaces:
CodeClass
CodeClass instances that represent normal Java Class objects.
Instances of IntrospectedCodeClass are generated using the static factory methods named forClass(). These methods ensure that the same IntrospectedCodeClass instance is returned for multiple invocations with the same argument.
- Author:
- Thomas Down, Matthew Pocock
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodeClassGet the CodeClass for a Java Class.static CodeClassGet the CodeClass for a Java class name.static CodeMethodgetConstructor(CodeClass[] args) Get a constructor by argument list.getFieldByName(String name) Get a field by its name.Get all fields accessible through this class.getJName()Get a method by name and argument list.Get all methods declared by this class and its super classes, removing all super class methods that are over ridden.getMethodsByName(String name) Get the name of all methods that could be invoked through this class with a given name.intGet the modifiers associated with the class.getName()booleanisArray()Discover if the class is an array type.booleanDiscover if the class represents a primitive type.toString()
-
Method Details
-
forClass
Get the CodeClass for a Java Class.- Parameters:
c- the Java Class to reflect- Returns:
- a CodeClass representing the class
-
forClass
Get the CodeClass for a Java class name.- Parameters:
name- the Java class name to reflect- Returns:
- a CodeClass representing the class
- Throws:
ClassNotFoundException
-
forMethod
-
getName
-
getJName
-
getDescriptor
- Specified by:
getDescriptorin interfaceCodeClass
-
getModifiers
public int getModifiers()Description copied from interface:CodeClassGet the modifiers associated with the class.- Specified by:
getModifiersin interfaceCodeClass- Returns:
- the modifier integer
-
getSuperClass
- Specified by:
getSuperClassin interfaceCodeClass
-
getInterfaces
- Specified by:
getInterfacesin interfaceCodeClass
-
getMethods
Description copied from interface:CodeClassGet all methods declared by this class and its super classes, removing all super class methods that are over ridden.This should return methods, regardless of their accessability.
- Specified by:
getMethodsin interfaceCodeClass- Returns:
- a Set containing all methods
-
getFieldByName
Description copied from interface:CodeClassGet a field by its name.- Specified by:
getFieldByNamein interfaceCodeClass- Parameters:
name- the field name- Returns:
- a CodeField representing the field
- Throws:
NoSuchFieldException- if there is no field by that name accessible through this class
-
getFields
Description copied from interface:CodeClassGet all fields accessible through this class. -
getMethodsByName
Description copied from interface:CodeClassGet the name of all methods that could be invoked through this class with a given name.- Specified by:
getMethodsByNamein interfaceCodeClass- Parameters:
name- the name of the method- Returns:
- a Set of CodeMethod instances with that name
-
getMethod
Description copied from interface:CodeClassGet a method by name and argument list.- Specified by:
getMethodin interfaceCodeClass- Parameters:
name- the name of the methodargs- the arguments it takes- Returns:
- a matching method
- Throws:
NoSuchMethodException- if there is no maching method
-
getConstructor
Description copied from interface:CodeClassGet a constructor by argument list.- Specified by:
getConstructorin interfaceCodeClass- Parameters:
args- the arguments it takes- Returns:
- a matching constructor
- Throws:
NoSuchMethodException- if there is no matching constructor
-
isPrimitive
public boolean isPrimitive()Description copied from interface:CodeClassDiscover if the class represents a primitive type.- Specified by:
isPrimitivein interfaceCodeClass- Returns:
- true if the class represents a primative type
-
isArray
public boolean isArray()Description copied from interface:CodeClassDiscover if the class is an array type. -
toString
-