|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ckkloverdos.type.java.JavaType
public class JavaType
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).
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 |
---|
public JavaType(java.lang.Class c)
Method Detail |
---|
public java.lang.Class getJavaClass()
public java.lang.String getName()
short class name
of the wrapped java class.
public java.lang.String getFullName()
class name
of the wrapped java class.
public boolean is(JavaType other, JavaTypeRegistry r)
true
iff other
public boolean is(JavaType other)
true
iff other
wraps the same java class.
other
- public boolean is(java.lang.Class otherClass, JavaTypeRegistry registry)
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
otherClass
- registry
- the JavaTypeRegistry
to checked against, if not null
.public boolean is(java.lang.Class otherClass)
true
iff otherClass
equals the java class
wrapped by this instance.
public boolean is(java.lang.String alias)
false
. Subclasses should normally delegate
to is(String, JavaTypeRegistry)
, provided that a type registry
has been defined elsewhere.
public boolean is(java.lang.String alias, JavaTypeRegistry registry)
registry
is the
same type as this instance.
public boolean equals(java.lang.Object other)
other
iff other
is strictly of JavaType class
and other
's wrapped class equals the wrapped class of this instance.
equals
in class java.lang.Object
other
- public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getDescription()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |