story.dbcore.attributes
Class TypeAttribute

java.lang.Object
  extended by story.dbcore.attributes.Attribute
      extended by story.dbcore.attributes.TypeAttribute

public class TypeAttribute
extends Attribute

Attribute for Type classes, i.e., those implementing GenericType.

Similar to EnumAttribute, but more formal due to its use of GenericType. Pass it a GenericType and it will only allow instances of that Type to be set. Value() will return the instance of the Type that was set, or null of none was set.


Constructor Summary
TypeAttribute(GenericType type)
          Constructor with GenericType and no initial value.
TypeAttribute(GenericType type, AttributeValue selected)
          Constructor with initial value.
 
Method Summary
 boolean equals(AttributeValue other)
          Determines whether one TypeAttribue value is equal to another.
 boolean greaterThan(AttributeValue other)
          Determines whether the attribute is greater than another attribute.
 int maxLength()
          All extending classes must report their maximum length.
 AttributeValue value()
          Get the attribute value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeAttribute

public TypeAttribute(GenericType type)
              throws Scheherexception
Constructor with GenericType and no initial value.

Throws:
Scheherexception

TypeAttribute

public TypeAttribute(GenericType type,
                     AttributeValue selected)
              throws Scheherexception
Constructor with initial value.

Throws:
Scheherexception
Method Detail

value

public AttributeValue value()
                     throws Scheherexception
Get the attribute value.

Throws:
Scheherexception

greaterThan

public boolean greaterThan(AttributeValue other)
                    throws Scheherexception
Determines whether the attribute is greater than another attribute. But since this required function doesn't make sense in the context of Types, throw an exception.

Specified by:
greaterThan in class Attribute
Throws:
Scheherexception

equals

public boolean equals(AttributeValue other)
               throws Scheherexception
Determines whether one TypeAttribue value is equal to another.

Specified by:
equals in class Attribute
Throws:
Scheherexception

maxLength

public int maxLength()
Description copied from class: Attribute
All extending classes must report their maximum length.

Specified by:
maxLength in class Attribute


Copyright © 2011 David K. Elson. All Rights Reserved.