org.progeeks.meta
Class ContainerPropertyType

java.lang.Object
  extended by org.progeeks.meta.ClassPropertyType
      extended by org.progeeks.meta.ContainerPropertyType
All Implemented Interfaces:
java.io.Serializable, PropertyType
Direct Known Subclasses:
ListPropertyType

public class ContainerPropertyType
extends ClassPropertyType

This represents a property type that is a container for objects of another type.

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

Constructor Summary
ContainerPropertyType(java.lang.Class baseClass, PropertyType valueType)
          Creates a ContainerPropertyType representing a container with values of the specified valueType.
ContainerPropertyType(PropertyType valueType)
          Creates a ContainerPropertyType representing a container with values of the specified valueType.
 
Method Summary
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(ContainerPropertyType type)
           
 boolean equals(java.lang.Object obj)
           
 PropertyType getValueType()
          Returns the type of values contained within lists of 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.
 ContainerPropertyType replaceContainedType(PropertyType valueType)
          Clones this container property type and replaces the value type with the type specified.
 java.lang.String toString()
           
protected  PropertyType wrapRawSuperType(java.lang.Object o)
          Called to wrap the specified super-type in a PropertyType.
 
Methods inherited from class org.progeeks.meta.ClassPropertyType
convertPrimitive, getBaseClass, getSuperTypes, isInstance
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContainerPropertyType

public ContainerPropertyType(PropertyType valueType)
Creates a ContainerPropertyType representing a container with values of the specified valueType. The base type will be of type Collection.


ContainerPropertyType

public ContainerPropertyType(java.lang.Class baseClass,
                             PropertyType valueType)
Creates a ContainerPropertyType representing a container with values of the specified valueType. The base type will be of the specified type.

Method Detail

replaceContainedType

public ContainerPropertyType replaceContainedType(PropertyType valueType)
Clones this container property type and replaces the value type with the type specified. Subclasses should implement this to provide the correct ContainerPropertyType implementation.


getValueType

public PropertyType getValueType()
Returns the type of values contained within lists of this type.


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 ContainerPropertyType instance or subclass instance. This implementation uses the contained type to further refine the assignability.

Specified by:
isAssignableFrom in interface PropertyType
Overrides:
isAssignableFrom in class ClassPropertyType

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. For containers, we actually iterate up the value type's chain of supertypes.

Overrides:
createRawSuperTypeIterator in class ClassPropertyType

wrapRawSuperType

protected PropertyType wrapRawSuperType(java.lang.Object o)
Called to wrap the specified super-type in a PropertyType. For containers, the object passed is a value type for which we'll wrap in a ContainerPropertyType like us.

Overrides:
wrapRawSuperType in class ClassPropertyType

equals

public boolean equals(ContainerPropertyType type)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class ClassPropertyType

toString

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


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