edu.umd.cs.findbugs.ba.type
Class ObjectType

java.lang.Object
  extended by edu.umd.cs.findbugs.graph.AbstractVertex<InheritanceGraphEdge,ObjectType>
      extended by edu.umd.cs.findbugs.ba.type.ObjectType
All Implemented Interfaces:
ReferenceType, Type, GraphVertex<ObjectType>, java.lang.Comparable<ObjectType>
Direct Known Subclasses:
ArrayType, ClassType

public abstract class ObjectType
extends AbstractVertex<InheritanceGraphEdge,ObjectType>
implements ReferenceType

Lightweight data structure representing an object type: a node in the class hierarchy (i.e., a class or interface). Note that not all object types represent Java classes or interfaces: e.g., array types.

Instances of Type participate in the flyweight pattern, meaning there is at most one instance per type. Instances should be created and accessed using the TypeRepository class.

Author:
David Hovemeyer

Field Summary
static int KNOWN
           
private  int state
           
private  SubtypeQueryResult subtypeQueryResult
           
private  java.lang.String typeSignature
           
static int UNCHECKED
           
static int UNKNOWN
           
 
Constructor Summary
protected ObjectType(java.lang.String typeSignature)
           
 
Method Summary
 java.lang.String getSignature()
          Return the JVM type signature.
 int getState()
          Get the state of this type: UNCHECKED, KNOWN, or UNKNOWN.
(package private)  SubtypeQueryResult getSubtypeQueryResult()
          Get the SubtypeQueryResult.
abstract  boolean isArray()
          Is this type an array type?
 boolean isBasicType()
          Is this type a basic type?
abstract  boolean isInterface()
          Determine if this type is an interface type (as opposed to a class or array type).
 boolean isReferenceType()
          Is this type a reference type?
 boolean isValidArrayElementType()
          Is this a valid array element type?
(package private)  void setState(int state)
          Set the state: UNCHECKED, KNOWN, or UNKNOWN.
(package private)  void setSubtypeQueryResult(SubtypeQueryResult subtypeQueryResult)
          Set the SubtypeQueryResult.
 
Methods inherited from class edu.umd.cs.findbugs.graph.AbstractVertex
compareTo, getLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.umd.cs.findbugs.ba.type.Type
accept, getTypeCode, isValidArrayBaseType
 

Field Detail

UNCHECKED

public static final int UNCHECKED
See Also:
Constant Field Values

KNOWN

public static final int KNOWN
See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

typeSignature

private java.lang.String typeSignature

state

private int state

subtypeQueryResult

private SubtypeQueryResult subtypeQueryResult
Constructor Detail

ObjectType

protected ObjectType(java.lang.String typeSignature)
Method Detail

getState

public int getState()
Get the state of this type: UNCHECKED, KNOWN, or UNKNOWN. This information is used by TypeRepository to determine when it needs to perform lazy hierarchy graph construction, or to dynamically resolve a class type.


setState

void setState(int state)
Set the state: UNCHECKED, KNOWN, or UNKNOWN.

Parameters:
state - the state

setSubtypeQueryResult

void setSubtypeQueryResult(SubtypeQueryResult subtypeQueryResult)
Set the SubtypeQueryResult.


getSubtypeQueryResult

SubtypeQueryResult getSubtypeQueryResult()
Get the SubtypeQueryResult.


getSignature

public java.lang.String getSignature()
Description copied from interface: Type
Return the JVM type signature. Note that some types do not have valid JVM signature representations. For example, the type of the null reference value cannot be represented as a signature. However, all basic types, class types, and array types have JVM signatures.

Specified by:
getSignature in interface Type

isBasicType

public boolean isBasicType()
Description copied from interface: Type
Is this type a basic type?

Specified by:
isBasicType in interface Type

isReferenceType

public boolean isReferenceType()
Description copied from interface: Type
Is this type a reference type?

Specified by:
isReferenceType in interface Type

isValidArrayElementType

public boolean isValidArrayElementType()
Description copied from interface: Type
Is this a valid array element type?

Specified by:
isValidArrayElementType in interface Type

isInterface

public abstract boolean isInterface()
Determine if this type is an interface type (as opposed to a class or array type). Note that for ClassTypes, the type must have been explicitly marked as a class or interface before this method is called. Otherwise, an IllegalStateException will be thrown.


isArray

public abstract boolean isArray()
Is this type an array type?