edu.umd.cs.findbugs.ba.generic

Class GenericObjectType

public class GenericObjectType extends ObjectType

Extension to ObjectType that includes additional information about the generic signature.

A GenericObjectType is either a parameterized type e.g. List<String>, or a type variable e.g. T.

This class cannot be initialized directly. Instead, create a GenericObjectType by calling GenericUtilities.getType(String) and passing in the bytecode signature for the type.

Author: Nat Ayewah

Method Summary
TypegetExtension()
intgetNumParameters()
ObjectTypegetObjectType()
ReferenceTypegetParameterAt(int index)
List<? extends ReferenceType>getParameters()
GenericUtilities.TypeCategorygetTypeCategory()
Get the TypeCategory that represents this Object
TypegetUpperBound()
StringgetVariable()
booleanhasParameters()
StringtoString(boolean includeGenerics)
Return a string representation of this object.

Method Detail

getExtension

public Type getExtension()

Returns: Returns the extension.

getNumParameters

public int getNumParameters()

Returns: the number of parameters if this is a parameterized class, 0 otherwise

getObjectType

public ObjectType getObjectType()

Returns: the underlying ObjectType for this Generic Object

getParameterAt

public ReferenceType getParameterAt(int index)

Parameters: index should be less than getNumParameters()

Returns: the type parameter at index

getParameters

public List<? extends ReferenceType> getParameters()

getTypeCategory

public GenericUtilities.TypeCategory getTypeCategory()
Get the TypeCategory that represents this Object

See Also: TypeCategory

getUpperBound

public Type getUpperBound()

getVariable

public String getVariable()

Returns: Returns the variable.

hasParameters

public boolean hasParameters()

Returns: true if this GenericObjectType represents a parameterized type e.g. List<String>. This implies that isVariable() is falses

toString

public String toString(boolean includeGenerics)
Return a string representation of this object. (I do not override toString() in case any existing code assumes that this object is an ObjectType and expects similar string representation. i.e. toString() is equivalent to toString(false))

Parameters: includeGenerics if true then the string includes generic information in this object. Otherwise this returns the same value as ObjectType.toString()

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.