Package org.biojava.utils.bytecode

# Class IntrospectedCodeClass

java.lang.Object
org.biojava.utils.bytecode.IntrospectedCodeClass

All Implemented Interfaces:
  `CodeClass`

public class IntrospectedCodeClass extends Object implements 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 Type
Method
Description
`static CodeClass`
`forClass(Class c)`
Get the CodeClass for a Java Class.
`static CodeClass`
`forClass(String name)`
Get the CodeClass for a Java class name.
`static CodeMethod`
`forMethod(Method method)`
`CodeMethod`
`getConstructor(CodeClass[] args)`
Get a constructor by argument list.
`String`
`getDescriptor()`
`CodeField`
`getFieldByName(String name)`
Get a field by its name.
`Set`
`getFields()`
Get all fields accessible through this class.
`List`
`getInterfaces()`
`String`
`getJName()`
`CodeMethod`
`getMethod(String name, CodeClass[] args)`
Get a method by name and argument list.
`Set`
`getMethods()`
Get all methods declared by this class and its super classes, removing all super class methods that are over ridden.
`Set`
`getMethodsByName(String name)`
Get the name of all methods that could be invoked through this class with a given name.
`int`
`getModifiers()`
Get the modifiers associated with the class.
`String`
`getName()`
`CodeClass`
`getSuperClass()`
`boolean`
`isArray()`
Discover if the class is an array type.
`boolean`
`isPrimitive()`
Discover if the class represents a primitive type.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Method Details

### forClass

public static CodeClass forClass(Class c)
Get the CodeClass for a Java Class.

Parameters:
  `c` - the Java Class to reflect
Returns:
  a CodeClass representing the class

### forClass

public static CodeClass forClass(String name) throws ClassNotFoundException
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

public static CodeMethod forMethod(Method method)

### getName

public String getName()

Specified by:
  `getName` in interface `CodeClass`

### getJName

public String getJName()

Specified by:
  `getJName` in interface `CodeClass`

### getDescriptor

public String getDescriptor()

Specified by:
  `getDescriptor` in interface `CodeClass`

### getModifiers

public int getModifiers()
Description copied from interface: `CodeClass`
Get the modifiers associated with the class.

Specified by:
  `getModifiers` in interface `CodeClass`
Returns:
  the modifier integer

### getSuperClass

public CodeClass getSuperClass()

Specified by:
  `getSuperClass` in interface `CodeClass`

### getInterfaces

public List getInterfaces()

Specified by:
  `getInterfaces` in interface `CodeClass`

### getMethods

public Set getMethods()
Description copied from interface: `CodeClass`
Get 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:
  `getMethods` in interface `CodeClass`
Returns:
  a Set containing all methods

### getFieldByName

public CodeField getFieldByName(String name) throws NoSuchFieldException
Description copied from interface: `CodeClass`
Get a field by its name.

Specified by:
  `getFieldByName` in interface `CodeClass`
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

public Set getFields()
Description copied from interface: `CodeClass`
Get all fields accessible through this class.

Specified by:
  `getFields` in interface `CodeClass`
Returns:
  a Set of all accessible fields

### getMethodsByName

public Set getMethodsByName(String name)
Description copied from interface: `CodeClass`
Get the name of all methods that could be invoked through this class with a given name.

Specified by:
  `getMethodsByName` in interface `CodeClass`
Parameters:
  `name` - the name of the method
Returns:
  a Set of CodeMethod instances with that name

### getMethod

public CodeMethod getMethod(String name, CodeClass[] args) throws NoSuchMethodException
Description copied from interface: `CodeClass`
Get a method by name and argument list.

Specified by:
  `getMethod` in interface `CodeClass`
Parameters:
  `name` - the name of the method
  `args` - the arguments it takes
Returns:
  a matching method
Throws:
  `NoSuchMethodException` - if there is no maching method

### getConstructor

public CodeMethod getConstructor(CodeClass[] args) throws NoSuchMethodException
Description copied from interface: `CodeClass`
Get a constructor by argument list.

Specified by:
  `getConstructor` in interface `CodeClass`
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: `CodeClass`
Discover if the class represents a primitive type.

Specified by:
  `isPrimitive` in interface `CodeClass`
Returns:
  true if the class represents a primative type

### isArray

public boolean isArray()
Description copied from interface: `CodeClass`
Discover if the class is an array type.

Specified by:
  `isArray` in interface `CodeClass`
Returns:
  true if the class is an array type

### toString

public String toString()

Overrides:
  `toString` in class `Object`