org.ckkloverdos.type.java
Class JavaType

java.lang.Object
  extended by org.ckkloverdos.type.java.JavaType

public class JavaType
extends java.lang.Object

A wrapper around java types with convenient methods for equality testing. In particular, this class works in conjuction with a JavaTypeRegistry, which can handle type aliases. I have developed this little-framework in order to have java types communicated between systems for which only an alias is meaningful. For example, a java.lang.Integer can be represented as an "INTEGER" string in a database and this can be properly mapped to the underlying Integer VM type by using a JavaTypeRegistry. This little-framework has been created owards representation & transformation, not subtyping (at the moment).

Author:
Christos KK Loverdos
See Also:
JavaTypeRegistry

Constructor Summary
JavaType(java.lang.Class c)
           
 
Method Summary
 boolean equals(java.lang.Object other)
          This instance equals other iff other is strictly of JavaType class and other's wrapped class equals the wrapped class of this instance.
 java.lang.String getDescription()
           
 java.lang.String getFullName()
          Returns the class name of the wrapped java class.
 java.lang.Class getJavaClass()
          Returns the java class wrapped by this instance.
 java.lang.String getName()
          Returns the short class name of the wrapped java class.
 int hashCode()
           
 boolean is(java.lang.Class otherClass)
          Returns true iff otherClass equals the java class wrapped by this instance.
 boolean is(java.lang.Class otherClass, JavaTypeRegistry registry)
          Returns true iff otherClass equals the java class wrapped by this instance, taking into account any representatives registered with registry.
 boolean is(JavaType other)
          Returns true iff other wraps the same java class.
 boolean is(JavaType other, JavaTypeRegistry r)
          Returns true iff other
 boolean is(java.lang.String alias)
          Always returns false.
 boolean is(java.lang.String alias, JavaTypeRegistry registry)
          Checks if the given alias, which must exist in registry is the same type as this instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaType

public JavaType(java.lang.Class c)
Method Detail

getJavaClass

public java.lang.Class getJavaClass()
Returns the java class wrapped by this instance.


getName

public java.lang.String getName()
Returns the short class name of the wrapped java class.


getFullName

public java.lang.String getFullName()
Returns the class name of the wrapped java class.


is

public boolean is(JavaType other,
                  JavaTypeRegistry r)
Returns true iff other


is

public boolean is(JavaType other)
Returns true iff other wraps the same java class.

Parameters:
other -

is

public boolean is(java.lang.Class otherClass,
                  JavaTypeRegistry registry)
Returns true iff otherClass equals the java class wrapped by this instance, taking into account any representatives registered with registry. If registry is null, then the result is computed by directly comparing equality between the class wrapped by this instance and otherClass

Parameters:
otherClass -
registry - the JavaTypeRegistry to checked against, if not null.

is

public boolean is(java.lang.Class otherClass)
Returns true iff otherClass equals the java class wrapped by this instance.


is

public boolean is(java.lang.String alias)
Always returns false. Subclasses should normally delegate to is(String, JavaTypeRegistry), provided that a type registry has been defined elsewhere.


is

public boolean is(java.lang.String alias,
                  JavaTypeRegistry registry)
Checks if the given alias, which must exist in registry is the same type as this instance.


equals

public boolean equals(java.lang.Object other)
This instance equals other iff other is strictly of JavaType class and other's wrapped class equals the wrapped class of this instance.

Overrides:
equals in class java.lang.Object
Parameters:
other -

hashCode

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

getDescription

public java.lang.String getDescription()

toString

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


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.