Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## things.data
Interface Attributes

All Superinterfaces:
  AttributeReader, java.io.Serializable

All Known Implementing Classes:
  ReadWriteableAttributes

    public interface Attributes

extends AttributeReader, java.io.Serializable

This defines something that has attributes and read access only.

## IMPORTANT NOTE: THIS SUCKS

This turned out to be a gigantic pain in the ass. We should have stuck with properties for everything. Oh, the irony. This came over from another project to support the error management. It should have been stopped at the door. It created two completely different ways to handle name/value pairs and a huge pile of crap code to transfer bits back and forth.

Version:
  1.0

  Version History

      EPG - Rewrite from another project. - 25 APR 05

Author:
  Erich P. Gatejen

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.
`java.lang.Object` | `get()` Get the underlying attribute data.
`boolean` | `removeAttribute(java.lang.String n)` Remove the named attribute.
`void` | `set(java.lang.Object o)` Get the underlying attribute data.

Methods inherited from interface things.data.AttributeReader
`getAttribute, getAttribute, getAttributeCount, getAttributeCount, getAttributeNames, getAttributes, getAttributes, getAttributeValueToString, getAttributeValueToString, getPrivateSet, hasAttribute, isMultivalueAllowed`

Method Detail

### allowMulti

    void allowMulti()

  Allow multi-attributes with the same name.

### disallowMulti

    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.
  The implementation may choose to ignore this state and merely trim the duplicates whne this method is called.

### addAttribute

    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.

  Parameters:
    `attribute` - the attribute
  Throws:
    `ThingsException`
  See Also:
    `NV`

### addAttribute

    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.

  Parameters:
    `v` - value of the attribute
  Throws:
    `ThingsException`

### addAttribute

    void addAttribute(AttributeReader reader)
                      throws ThingsException

  Add all the attributes that can be read from the reader.

  Parameters:
    `reader` - a reader
  Throws:
    `ThingsException`

### addMultiAttributes

    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.

  Parameters:
    `attributes` - The attributes in pairs.
  Throws:
    `ThingsException`

### addMultiAttributes

    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.

  Parameters:
    `attributes` - The attributes in pairs, except the first which will be the value pairing with the parameter name.
  Throws:
    `ThingsException`

### removeAttribute

    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.

  Parameters:
    `n` - name of the attribute
  Throws:
    `ThingsException`

### get

    java.lang.Object get()

  Get the underlying attribute data. This can be dangerous! The data is alterable. We will protect it some by passing it as an Object.

  Returns:
    An object for the underlying data structure.

### set

    void set(java.lang.Object o)
             throws ThingsException

  Get the underlying attribute data. This can be dangerous! The data is alterable. We will protect it some by passing it as an Object. If it is not the proper type, it will throw a ThingsException.

  Throws:
    `ThingsException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Things.