aspoev.interpreter.base
Class TypeReferenceElement

java.lang.Object
  extended byaspoev.interpreter.base.Element
      extended byaspoev.interpreter.base.StatementElement
          extended byaspoev.interpreter.base.RValuedElement
              extended byaspoev.interpreter.base.TypeReferenceElement
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, aspoev.Executable, pJ.jasmine.PRI, java.io.Serializable
Direct Known Subclasses:
CompoundTypeReferenceElement

public class TypeReferenceElement
extends RValuedElement
implements java.lang.Comparable, pJ.jasmine.PRI

A reference to a type in Vejal. The reference consists merely of a namespace, a name, and version, that serves as a pointer of sorts in the Interpreter to the type's declaration. The actual type referenced by any instance of this class is a ClassDeclarationElement. The type referenced by an instance of this class can be retrieved by calling 'lookUpClass(TypeReferenceElement)' on the Interpreter (aspoev.interpreter.Interpreter), and passing this object as the argument.

See Also:
Serialized Form

Field Summary
static TypeReferenceElement BINDING
           
static TypeReferenceElement BOOLEAN
           
static TypeReferenceElement DOUBLE
           
static TypeReferenceElement JAVA_OBJECT
           
static TypeReferenceElement LIST
           
static TypeReferenceElement MAP
           
protected  java.lang.String nameSpace
           
static TypeReferenceElement SET
           
static TypeReferenceElement STRING
           
protected  java.lang.String typeName
           
protected  VersionObject version
           
static TypeReferenceElement VOID
           
 
Fields inherited from class aspoev.interpreter.base.Element
parent
 
Fields inherited from interface pJ.jasmine.PRI
DELETECHANGE, MODIFYCHANGE, NOCHANGE
 
Constructor Summary
protected TypeReferenceElement(java.lang.String name)
           
protected TypeReferenceElement(java.lang.String nameSpace, java.lang.String name)
           
protected TypeReferenceElement(java.lang.String nameSpace, java.lang.String typeName, VersionObject version)
           
protected TypeReferenceElement(java.lang.String typeName, VersionObject version)
           
 
Method Summary
 boolean assignableFrom(TypeReferenceElement otherType)
          This is an aspect binding point.
 java.lang.Object clone()
           
 int compareTo(java.lang.Object other)
          Returns -1 if 'this' type is a lower version than 'other', 0 if the two types are equal, and 1 if 'this' tye is a higher version than 'other'.
static TypeReferenceElement create(java.lang.String name)
          Creates a type with the given name.
static TypeReferenceElement create(java.lang.String nameSpace, java.lang.String name)
          Creates a type with the given name space and name.
static TypeReferenceElement create(java.lang.String nameSpace, java.lang.String name, VersionObject version)
          Creates a type with the given name space, name, and version.
static TypeReferenceElement create(java.lang.String name, VersionObject version)
          Creates a type with the given name and version.
 boolean equals(java.lang.Object other)
           
 boolean equals(TypeReferenceElement other)
          Evaluates the equality of two types.
 java.util.Collection getChildrenByType(java.lang.Class childClass)
           
 ClassDeclarationElement getClassDeclaration()
          Returns the class definition associated with this type.
 java.lang.String getCodeString()
           
 pJ.jasmine.ListOfObject getSubclasses()
          Returns a list of the types that derive directly from this type.
 boolean hasCommonBaseType(TypeReferenceElement other)
           
 int hashCode()
           
 boolean isJavaType()
          Returns true if this object is not a primitive nor a Vejal object, but rather a POJO.
 boolean isPrimitive()
          Returns true if this object is a String, Boolean, or Double.
 TypeReferenceElement newVersion()
           
static TypeReferenceElement newVersion(TypeReferenceElement baseVersion)
          Creates a new version of the type, incrementing the version object.
 java.lang.String toString()
           
static TypeReferenceElement typeObject(java.lang.Object object)
           
 
Methods inherited from class aspoev.interpreter.base.StatementElement
executeElement
 
Methods inherited from class aspoev.interpreter.base.Element
execute, getRValue, persist
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VOID

public static final TypeReferenceElement VOID

DOUBLE

public static final TypeReferenceElement DOUBLE

JAVA_OBJECT

public static final TypeReferenceElement JAVA_OBJECT

STRING

public static final TypeReferenceElement STRING

BOOLEAN

public static final TypeReferenceElement BOOLEAN

LIST

public static final TypeReferenceElement LIST

MAP

public static final TypeReferenceElement MAP

SET

public static final TypeReferenceElement SET

BINDING

public static final TypeReferenceElement BINDING

nameSpace

protected java.lang.String nameSpace

typeName

protected java.lang.String typeName

version

protected VersionObject version
Constructor Detail

TypeReferenceElement

protected TypeReferenceElement(java.lang.String nameSpace,
                               java.lang.String typeName,
                               VersionObject version)

TypeReferenceElement

protected TypeReferenceElement(java.lang.String typeName,
                               VersionObject version)

TypeReferenceElement

protected TypeReferenceElement(java.lang.String nameSpace,
                               java.lang.String name)

TypeReferenceElement

protected TypeReferenceElement(java.lang.String name)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in class Element

assignableFrom

public boolean assignableFrom(TypeReferenceElement otherType)
This is an aspect binding point. While some schema managers will allow different versions of the same type to be assigned to each other, some may not. Default implementation simply looks for the argument type in this type's super types.


compareTo

public int compareTo(java.lang.Object other)
Returns -1 if 'this' type is a lower version than 'other', 0 if the two types are equal, and 1 if 'this' tye is a higher version than 'other'.

Specified by:
compareTo in interface java.lang.Comparable

create

public static TypeReferenceElement create(java.lang.String name,
                                          VersionObject version)
Creates a type with the given name and version. This method monitors basic type creation to return common representations of primitives, collection objects, etc.


create

public static TypeReferenceElement create(java.lang.String name)
Creates a type with the given name.


create

public static TypeReferenceElement create(java.lang.String nameSpace,
                                          java.lang.String name)
Creates a type with the given name space and name.


create

public static TypeReferenceElement create(java.lang.String nameSpace,
                                          java.lang.String name,
                                          VersionObject version)
Creates a type with the given name space, name, and version.


getClassDeclaration

public ClassDeclarationElement getClassDeclaration()
Returns the class definition associated with this type.


getSubclasses

public pJ.jasmine.ListOfObject getSubclasses()
Returns a list of the types that derive directly from this type.


equals

public boolean equals(TypeReferenceElement other)
Evaluates the equality of two types. Schema managing objects may want to bind here to change the concept of type equality with respect to versioning.


equals

public boolean equals(java.lang.Object other)

hasCommonBaseType

public boolean hasCommonBaseType(TypeReferenceElement other)

hashCode

public int hashCode()

newVersion

public static TypeReferenceElement newVersion(TypeReferenceElement baseVersion)
Creates a new version of the type, incrementing the version object.


newVersion

public TypeReferenceElement newVersion()

getChildrenByType

public java.util.Collection getChildrenByType(java.lang.Class childClass)
Specified by:
getChildrenByType in class Element

getCodeString

public java.lang.String getCodeString()
Specified by:
getCodeString in class Element

toString

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

isPrimitive

public boolean isPrimitive()
Returns true if this object is a String, Boolean, or Double.


isJavaType

public boolean isJavaType()
Returns true if this object is not a primitive nor a Vejal object, but rather a POJO.


typeObject

public static TypeReferenceElement typeObject(java.lang.Object object)