story.dbcore.attributes
Class EnumAttribute

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

public class EnumAttribute
extends Attribute

Attribute for enums, i.e., sets of strings, so that the attribute can only be set to one of those strings (or null).

Pass it a HashSet of objects that are possible, and it will only allow objects whose string serializations (using toString()) are present in the HashSet to be set.


Constructor Summary
EnumAttribute(ImmutableHashSet myEnum)
          Constructor with enum HashSet and no initial value.
EnumAttribute(ImmutableHashSet myEnum, AttributeValue selected)
          Constructor with initial value.
 
Method Summary
 boolean equals(AttributeValue other)
          Determines whether one EnumAttribue 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.
 java.lang.String renderMembers()
           
 AttributeValue value()
          Get the attribute value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumAttribute

public EnumAttribute(ImmutableHashSet myEnum)
Constructor with enum HashSet and no initial value.


EnumAttribute

public EnumAttribute(ImmutableHashSet myEnum,
                     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 EnumAttributes, throw an exception.

Specified by:
greaterThan in class Attribute
Throws:
Scheherexception

equals

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

Specified by:
equals in class Attribute
Throws:
Scheherexception

maxLength

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

Specified by:
maxLength in class Attribute
Throws:
Scheherexception

renderMembers

public java.lang.String renderMembers()


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