com.cafesoft.cams.attr
Class AbstractAttributeValue

java.lang.Object
  |
  +--com.cafesoft.cams.attr.AbstractAttributeValue
All Implemented Interfaces:
AttributeValue, Evaluatable
Direct Known Subclasses:
BagAttributeValue, BooleanAttributeValue, StringAttributeValue

public abstract class AbstractAttributeValue
extends Object
implements AttributeValue

AbstractAttributeValue is an abstract base class for all attribute data types.

To provide a new type, extend this class and implement the equals(Object) and hashCode methods from Object, which are used for equality checking.

Since:
4/16/2004

Constructor Summary
protected AbstractAttributeValue(URI type)
          Constructor that takes the specific attribute type.
 
Method Summary
abstract  String encode()
          Encodes the value in a form suitable for including in XML data like a request or an obligation.
 EvaluationResult evaluate(EvaluationContext evalContext)
          Implements the required interface from Evaluatable.
 boolean evaluatesToBag()
          Returns whether or not this value is actually a bag of values.
 URI getType()
          Returns the type of this attribute value.
 boolean isBag()
          Returns whether or not this value is actually a bag of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAttributeValue

protected AbstractAttributeValue(URI type)
Constructor that takes the specific attribute type.

Parameters:
type - the attribute's type
Method Detail

getType

public URI getType()
Returns the type of this attribute value.

Specified by:
getType in interface AttributeValue
Returns:
the attribute's type

evaluatesToBag

public final boolean evaluatesToBag()
Returns whether or not this value is actually a bag of values.

NOTE: This is a required interface from Evaluatable, but the more appropriate isBag method is used by AttributeValues, so this method is declared as final and calls the isBag method for this value.

Specified by:
evaluatesToBag in interface Evaluatable
Returns:
true if this is a bag of values, false otherwise

isBag

public boolean isBag()
Returns whether or not this value is actually a bag of values. By default this returns false. Typically, only the BagAttribute should ever override this to return true.

Specified by:
isBag in interface AttributeValue
Returns:
true if this is a bag of values, false otherwise

evaluate

public EvaluationResult evaluate(EvaluationContext evalContext)
Implements the required interface from Evaluatable. Since there is nothing to evaluate in an attribute value, the default result is just this instance. Override this method if you want special behavior, like a dynamic value.

Specified by:
evaluate in interface Evaluatable
Parameters:
evalContext - the representation of the request
Returns:
a successful evaluation containing this value

encode

public abstract String encode()
Encodes the value in a form suitable for including in XML data like a request or an obligation. This must return a value that could in turn be used by the factory to create a new instance with the same value.

Specified by:
encode in interface AttributeValue
Returns:
a String form of the value


Generated on 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.