com.virtuosotechnologies.lib.base
Class UniqueClassConstrainedKey

java.lang.Object
  extended bycom.virtuosotechnologies.lib.base.UniqueObject
      extended bycom.virtuosotechnologies.lib.base.UniqueClassConstrainedKey
All Implemented Interfaces:
ClassConstrainedKey, ConstrainedKey

public class UniqueClassConstrainedKey
extends UniqueObject
implements ClassConstrainedKey

A UniqueObject base class implementing ClassConstrainedKey


Constructor Summary
UniqueClassConstrainedKey(Class guarantee)
          Constructor
UniqueClassConstrainedKey(String description, Class guarantee)
          Constructor
 
Method Summary
 Class getConstrainingClass()
          Get the class of the constraint.
 boolean isConstraintSatisfiedBy(Object obj)
          Returns true if the given object matches the constraint.
 
Methods inherited from class com.virtuosotechnologies.lib.base.UniqueObject
equals, getUniqueObjectID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniqueClassConstrainedKey

public UniqueClassConstrainedKey(Class guarantee)
Constructor

Parameters:
guarantee - the guaranteed class representing the constraint

UniqueClassConstrainedKey

public UniqueClassConstrainedKey(String description,
                                 Class guarantee)
Constructor

Parameters:
description - the description string returned by toString
guarantee - the guaranteed class representing the constraint
Method Detail

getConstrainingClass

public Class getConstrainingClass()
Get the class of the constraint.

Specified by:
getConstrainingClass in interface ClassConstrainedKey
Returns:
a Class that must be assignable from all legal values

isConstraintSatisfiedBy

public boolean isConstraintSatisfiedBy(Object obj)
Returns true if the given object matches the constraint.

Specified by:
isConstraintSatisfiedBy in interface ConstrainedKey
Parameters:
obj - object to test
Returns:
true if the object matches the constraint