org.progeeks.meta
Class ClassPropertyType

java.lang.Object
  extended by org.progeeks.meta.ClassPropertyType
All Implemented Interfaces:
java.io.Serializable, PropertyType
Direct Known Subclasses:
ClassEnumeratedPropertyType, ContainerPropertyType, DateTimeType, FileType, LongStringType, PercentType, RangedNumberType

public class ClassPropertyType
extends java.lang.Object
implements PropertyType

Property type implementation that represents a Java class directly.

Version:
$Revision: 1.6 $
Author:
Paul Speed
See Also:
Serialized Form

Constructor Summary
  ClassPropertyType(java.lang.Class type)
           
protected ClassPropertyType(java.lang.Class type, boolean returnSuperTypes)
          Constructor allowing subclasses to configure the returning of supertypes.
 
Method Summary
static java.lang.Class convertPrimitive(java.lang.Class type)
          If the specified class is a primitive class then the wrapper version of the class is returned.
protected  java.util.Iterator createRawSuperTypeIterator()
          Called by getSuperTypes() to create the Iterator and can be used for custom configuration of the iterator as necessary.
 boolean equals(java.lang.Object o)
           
 java.lang.Class getBaseClass()
          Returns the Java class upon which this property type is based.
 java.util.Iterator getSuperTypes()
          Returns an iterator containing all potential supertypes for this type.
 int hashCode()
           
 boolean isAssignableFrom(PropertyType type)
          Returns true if the specified type is the same as or a subclass of this property type.
 boolean isInstance(java.lang.Object obj)
          Returns true if the specified object is an instance of this type.
 java.lang.String toString()
           
protected  PropertyType wrapRawSuperType(java.lang.Object o)
          Called to wrap the specified class in a PropertyType.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassPropertyType

public ClassPropertyType(java.lang.Class type)

ClassPropertyType

protected ClassPropertyType(java.lang.Class type,
                            boolean returnSuperTypes)
Constructor allowing subclasses to configure the returning of supertypes. Sometimes it doesn't make sense to do so either for complexity or other reasons. I think all types should implement this functionality, but I'm covering my bases.

Method Detail

convertPrimitive

public static java.lang.Class convertPrimitive(java.lang.Class type)
If the specified class is a primitive class then the wrapper version of the class is returned. Otherwise, the specified class is returned.


getBaseClass

public java.lang.Class getBaseClass()
Returns the Java class upon which this property type is based.

Specified by:
getBaseClass in interface PropertyType

isInstance

public boolean isInstance(java.lang.Object obj)
Returns true if the specified object is an instance of this type.

Specified by:
isInstance in interface PropertyType

isAssignableFrom

public boolean isAssignableFrom(PropertyType type)
Returns true if the specified type is the same as or a subclass of this property type. This method will always return false if the specified type is not a ClassPropertyType instance or subclass instance.

Specified by:
isAssignableFrom in interface PropertyType

createRawSuperTypeIterator

protected java.util.Iterator createRawSuperTypeIterator()
Called by getSuperTypes() to create the Iterator and can be used for custom configuration of the iterator as necessary.


wrapRawSuperType

protected PropertyType wrapRawSuperType(java.lang.Object o)
Called to wrap the specified class in a PropertyType.


getSuperTypes

public java.util.Iterator getSuperTypes()
Returns an iterator containing all potential supertypes for this type. This will return a PropertyType for every superclass and implemented interface for this class' base class.

Specified by:
getSuperTypes in interface PropertyType

equals

public boolean equals(java.lang.Object o)
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


Copyright © 2002-2003 Paul Speed. All Rights Reserved.