Package org.biojava.utils.bytecode

# Class ParametricType

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

public class ParametricType extends Object
A template type.

Template types are resolved at code-generation type rather than at Instruction generation type. They let you bind the concrete type for opcodes at the last minute, so the same max conditional could be used for all primative types, with the type only being bound at the last moment.

Two ParametricType instances are the same if they are the same object, regardless of their names.

Author:
  Matthew Pocock

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canAccept(CodeClass cc)`
`static ParametricType`
`createArrayType(String name)`
Create a new ParametricType that claims to resolve to an array type.
`static ParametricType`
`createObjectType(String name)`
Create a new ParametricType that claims to resolve to an object type.
`static ParametricType`
`createPrimitiveType(String name)`
Create a new ParametricType that claims to resolve to a primative type.
`static ParametricType`
`createType(String name)`
Create a new ParametricType that claims nothing.
`static ParametricType`
`createType(String name, CodeClass[] classes)`
Create a new ParametricType that claims to be castable to all the classes in a list.
`CodeClass[]`
`getClasses()`
`String`
`getName()`
Get the name of this type.
`boolean`
`isArray()`
`boolean`
`isObject()`
`boolean`
`isPrimitive()`
Discover if this type must resolve to a primative.
`String`
`toString()`

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

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

## Method Details

### createType

public static ParametricType createType(String name)
Create a new ParametricType that claims nothing.

Parameters:
  `name` - the name given to this type
Returns:
  a new ParametricType instance with that name

### createPrimitiveType

public static ParametricType createPrimitiveType(String name)
Create a new ParametricType that claims to resolve to a primative type.

Parameters:
  `name` - the name given to this type
Returns:
  a new ParametricType instance with that name

### createObjectType

public static ParametricType createObjectType(String name)
Create a new ParametricType that claims to resolve to an object type.

Parameters:
  `name` - the name given to this type
Returns:
  a new ParametricType instance with that name

### createArrayType

public static ParametricType createArrayType(String name)
Create a new ParametricType that claims to resolve to an array type. All array types are object types.

Parameters:
  `name` - the name given to this type
Returns:
  a new ParametricType instance with that name

### createType

public static ParametricType createType(String name, CodeClass[] classes)
Create a new ParametricType that claims to be castable to all the classes in a list. Since neither Java nor bytecode support multiple inheritance, the classes must either be interfaces, or classes that fall into an inheritance path.

Parameters:
  `name` - the name given to this type
  `classes` - an array of Class objects that any bound type must be castable to
Returns:
  a new ParametricType that can bind to classes with these properties

### getName

public String getName()
Get the name of this type. Names are not unique.

Returns:
  the name given to this type

### isPrimitive

public boolean isPrimitive()
Discover if this type must resolve to a primative.

It is an error for a parametric type to resolve to a non-primative if this flag is set.

Returns:
  true if this is guaranteed to resolve to a primative

### isObject

public boolean isObject()

### isArray

public boolean isArray()

### canAccept

public boolean canAccept(CodeClass cc)

### getClasses

public CodeClass[] getClasses()

### toString

public String toString()

Overrides:
  `toString` in class `Object`