org.progeeks.meta.type
Class RangedNumberType

java.lang.Object
  extended by org.progeeks.meta.ClassPropertyType
      extended by org.progeeks.meta.type.RangedNumberType
All Implemented Interfaces:
java.io.Serializable, PropertyType

public class RangedNumberType
extends ClassPropertyType

ClassPropertyType subclass that represents a number with a minimum and maximum range. Normally, this is not the way one would do things. The "meta-jb way" would be to give your properties type subclasses that are specific to your application. They're mostly just tagging place-holders anyway. However, it seemed like a large swath of types could be taken care of with bound numbers without _requiring_ the app to subclass. The app is still encouraged to do so (by subclassing this type), but at least now we can build in nice default behavior for ranged numbers.

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

Constructor Summary
RangedNumberType(java.lang.Class baseType, java.lang.Number minimum, java.lang.Number maximum)
          Creates a bound number type for the specified number class and range.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.Number getMaximumValue()
          Returns the maximum for the number range.
 java.lang.Number getMinimumValue()
          Returns the minimum for the number range.
 int hashCode()
           
 boolean isInstance(java.lang.Object obj)
          Returns true if the specified object is an instance of this type and fits within the specified range inclusively.
 
Methods inherited from class org.progeeks.meta.ClassPropertyType
convertPrimitive, createRawSuperTypeIterator, getBaseClass, getSuperTypes, isAssignableFrom, toString, wrapRawSuperType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangedNumberType

public RangedNumberType(java.lang.Class baseType,
                        java.lang.Number minimum,
                        java.lang.Number maximum)
Creates a bound number type for the specified number class and range.

Method Detail

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class ClassPropertyType

isInstance

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

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

getMinimumValue

public java.lang.Number getMinimumValue()
Returns the minimum for the number range.


getMaximumValue

public java.lang.Number getMaximumValue()
Returns the maximum for the number range.



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