things.data.impl
Class ReadWriteableAttributes

java.lang.Object
  extended by things.data.impl.ReadableAttributes
      extended by things.data.impl.ReadWriteableAttributes
All Implemented Interfaces:
java.io.Serializable, AttributeReader, Attributes

public class ReadWriteableAttributes
extends ReadableAttributes
implements Attributes

A set of writable attributes.

Version:
1.0

Version History

EPG - Initial - 23 AUG 05
 
Author:
Erich P. Gatejen
See Also:
Serialized Form

Field Summary
static ReadableAttributes permanentlyEmptyAttribute
          This is a static attribute object that will forever be empty.
 
Fields inherited from class things.data.impl.ReadableAttributes
mYAttributes
 
Constructor Summary
ReadWriteableAttributes()
           
 
Method Summary
 void addAttribute(AttributeReader reader)
          Add all the attributes that can be read from the reader.
 void addAttribute(NVImmutable attribute)
          Add an attribute in the native NV.
 void addAttribute(java.lang.String n, java.lang.String v)
          Add an attribute--single name to single value.
 void addMultiAttributes(java.lang.String... attributes)
          Add multiple attributes--single name to single value.
 void addMultiAttributes(java.lang.String name, java.lang.String... attributes)
          Add multiple attributes--single name to single value.
 void allowMulti()
          Allow multi-attributes with the same name.
 void disallowMulti()
          Disallow multi-attributes with the same name.
 boolean removeAttribute(java.lang.String n)
          Remove the named attribute.
 
Methods inherited from class things.data.impl.ReadableAttributes
get, getAttribute, getAttribute, getAttributeCount, getAttributeCount, getAttributeNames, getAttributes, getAttributes, getAttributeValueToString, getAttributeValueToString, getPrivateSet, hasAttribute, isMultivalueAllowed, set, validateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface things.data.Attributes
get, set
 
Methods inherited from interface things.data.AttributeReader
getAttribute, getAttribute, getAttributeCount, getAttributeCount, getAttributeNames, getAttributes, getAttributes, getAttributeValueToString, getAttributeValueToString, getPrivateSet, hasAttribute, isMultivalueAllowed
 

Field Detail

permanentlyEmptyAttribute

public static final ReadableAttributes permanentlyEmptyAttribute
This is a static attribute object that will forever be empty.

Constructor Detail

ReadWriteableAttributes

public ReadWriteableAttributes()
Method Detail

addAttribute

public void addAttribute(NVImmutable attribute)
                  throws ThingsException
Add an attribute in the native NV. If attribute is already set, it will overwrite it. The NV value may have multi-values.

Specified by:
addAttribute in interface Attributes
Parameters:
attribute - the attribute
Throws:
ThingsException
See Also:
NVImmutable

addAttribute

public void addAttribute(java.lang.String n,
                         java.lang.String v)
                  throws ThingsException
Add an attribute--single name to single value. If attribute is already set, it will overwrite it.

Specified by:
addAttribute in interface Attributes
Parameters:
n - name of the attribute
v - value of the attribute
Throws:
ThingsException

addAttribute

public void addAttribute(AttributeReader reader)
                  throws ThingsException
Add all the attributes that can be read from the reader.

Specified by:
addAttribute in interface Attributes
Parameters:
reader - a reader
Throws:
ThingsException

addMultiAttributes

public void addMultiAttributes(java.lang.String... attributes)
                        throws ThingsException
Add multiple attributes--single name to single value. If attribute is already set, it will overwrite it.

Specified by:
addMultiAttributes in interface Attributes
Parameters:
attributes - The attributes in pairs.
Throws:
ThingsException

addMultiAttributes

public void addMultiAttributes(java.lang.String name,
                               java.lang.String... attributes)
                        throws ThingsException
Add multiple attributes--single name to single value. If attribute is already set, it will overwrite it. The first attribute name will come from the name parameter. Then the first attribute value will head the attribute parameter. All following will be name/value pairs.

Specified by:
addMultiAttributes in interface Attributes
Parameters:
name - The name
attributes - The attributes in pairs, except the first which will be the value pairing with the parameter name.
Throws:
ThingsException

removeAttribute

public boolean removeAttribute(java.lang.String n)
                        throws ThingsException
Remove the named attribute. If the attribute existed, it will be deleted (along with multi-values), it will return true. If it does not exist, it will return false.

Specified by:
removeAttribute in interface Attributes
Parameters:
n - name of the attribute
Throws:
ThingsException

allowMulti

public void allowMulti()
Allow multi-attributes with the same name. This is ignored.

Specified by:
allowMulti in interface Attributes

disallowMulti

public void disallowMulti()
Disallow multi-attributes with the same name. If the attribute set already has multi-attributes attributes, it should trim the attributes to a single value. The interface does not define how this will happen.
This is ignored.
The implementation may choose to ignore this state and merely trim the duplicates whne this method is called.

Specified by:
disallowMulti in interface Attributes


Things.