com.ibm.wala.types
Class TypeName

java.lang.Object
  extended by com.ibm.wala.types.TypeName
All Implemented Interfaces:
java.io.Serializable

public final class TypeName
extends java.lang.Object
implements java.io.Serializable

We've introduced this class to canonicalize Atoms that represent package names. NB: All package names should use '/' and not '.' as a separator. eg. Ljava/lang/Class

See Also:
Serialized Form

Method Summary
 boolean equals(java.lang.Object obj)
           
static TypeName findOrCreate(ImmutableByteArray name)
           
static TypeName findOrCreate(ImmutableByteArray name, int start, int length)
           
static TypeName findOrCreate(java.lang.String name)
           
static TypeName findOrCreateClass(Atom packageName, Atom className)
           
static TypeName findOrCreateClassName(java.lang.String packageName, java.lang.String className)
           
 TypeName getArrayTypeForElementType()
           
 Atom getClassName()
           
 int getDimensionality()
           
 TypeName getInnermostElementType()
          Return the innermost element type reference for an array
 Atom getPackage()
           
 int hashCode()
           
 boolean isArrayType()
          Does 'this' refer to an array?
 boolean isClassType()
          Does 'this' refer to a class?
 boolean isPrimitiveType()
          Does 'this' refer to a primitive type
 TypeName parseForArrayElementName()
           
static TypeName string2TypeName(java.lang.String s)
           
 java.lang.String toString()
           
 java.lang.String toUnicodeString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

findOrCreate

public static TypeName findOrCreate(ImmutableByteArray name,
                                    int start,
                                    int length)
                             throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

findOrCreate

public static TypeName findOrCreate(ImmutableByteArray name)
                             throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

findOrCreate

public static TypeName findOrCreate(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

findOrCreateClass

public static TypeName findOrCreateClass(Atom packageName,
                                         Atom className)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toUnicodeString

public java.lang.String toUnicodeString()

string2TypeName

public static TypeName string2TypeName(java.lang.String s)
                                throws java.lang.IllegalArgumentException
Parameters:
s - a String like Ljava/lang/Object
Returns:
the corresponding TypeName
Throws:
java.lang.IllegalArgumentException - if s is null

findOrCreateClassName

public static TypeName findOrCreateClassName(java.lang.String packageName,
                                             java.lang.String className)

parseForArrayElementName

public TypeName parseForArrayElementName()
Returns:
the name of the array element type for an array

getArrayTypeForElementType

public TypeName getArrayTypeForElementType()
Returns:
a type name that represents an array of this element type

getDimensionality

public final int getDimensionality()
Returns:
the dimensionality of the type. By convention, class types have dimensionality 0, primitves -1, and arrays the number of [ in their descriptor.

isClassType

public final boolean isClassType()
Does 'this' refer to a class?


isArrayType

public final boolean isArrayType()
Does 'this' refer to an array?


isPrimitiveType

public final boolean isPrimitiveType()
Does 'this' refer to a primitive type


getInnermostElementType

public final TypeName getInnermostElementType()
Return the innermost element type reference for an array


getPackage

public Atom getPackage()
Returns:
the Atom naming the package for this type.

getClassName

public Atom getClassName()
Returns:
the Atom naming the class for this type (without package)