things.data
Interface AttributeReader

All Known Subinterfaces:
Attributes
All Known Implementing Classes:
AttributesReaderWrapper, ReadableAttributes, ReadWriteableAttributes

public interface AttributeReader

This defines something that has attributes but can only be read.

Version:
1.0
Version History

, 1.0

Version History

EPG - Rewrite from another project - 25 APR 05
 
Author:
Erich P. Gatejen
, Erich P. Gatejen

Method Summary
 NVImmutable getAttribute(java.lang.String n)
          Get an attribute.
 NVImmutable getAttribute(java.lang.String n, int index)
          Get an attribute from a multi-attribute by index.
 int getAttributeCount()
          Get the total attribute count.
 int getAttributeCount(java.lang.String n)
          Get the total attribute count for a specific name.
 java.util.Collection<java.lang.String> getAttributeNames()
          Get a collection of attribute names.
 java.util.Collection<NVImmutable> getAttributes()
          Get a collection of the attributes.
 java.util.Collection<NVImmutable> getAttributes(java.lang.String n)
          Get a collection of the attributes for the name.
 java.lang.String getAttributeValueToString(java.lang.String n)
          Get an attribute value rendered as a string.
 java.lang.String getAttributeValueToString(java.lang.String n, java.lang.String defaultValue)
          Get an attribute value rendered as a string.
 Attributes getPrivateSet()
          Get a private set that can be manipulated.
 boolean hasAttribute(java.lang.String n)
          Check if it has an attribute.
 boolean isMultivalueAllowed()
          Ask if multi-value is allowed.
 

Method Detail

isMultivalueAllowed

boolean isMultivalueAllowed()
Ask if multi-value is allowed.

Returns:
true if it is allowed.

getAttribute

NVImmutable getAttribute(java.lang.String n)
Get an attribute. If the name of the attribute is null or the attribute does not exist, it should return null. If it is a multi, it will return the first.

Parameters:
n - name of the attribute
Returns:
the value or null if not set.

getAttributeValueToString

java.lang.String getAttributeValueToString(java.lang.String n)
Get an attribute value rendered as a string. If the name of the attribute is null or the attribute does not exist, it should return null. If it is a multi, it will return the first.

Parameters:
n - name of the attribute
Returns:
the value or null if not set.

getAttributeValueToString

java.lang.String getAttributeValueToString(java.lang.String n,
                                           java.lang.String defaultValue)
Get an attribute value rendered as a string. If the name of the attribute is null or the attribute does not exist, it should return null. If it is a multi, it will return the first.

Parameters:
n - name of the attribute
defaultValue - the value it will return if the name maps to a null.
Returns:
the value or null if not set.

hasAttribute

boolean hasAttribute(java.lang.String n)
Check if it has an attribute.

Parameters:
n - name of the attribute
Returns:
true if it has the attribute, otherwise false.

getAttributes

java.util.Collection<NVImmutable> getAttributes()
Get a collection of the attributes.

Returns:
The collection.

getAttributes

java.util.Collection<NVImmutable> getAttributes(java.lang.String n)
Get a collection of the attributes for the name.

Parameters:
n - name of the attribute
Returns:
The collection.

getAttribute

NVImmutable getAttribute(java.lang.String n,
                         int index)
Get an attribute from a multi-attribute by index. This will work with single value items, as long as the index is zero. This is not a fast operation, so don't use it in time critical areas. It will always return null rather than throw an exception.

Parameters:
n - name of the attribute
index - the index of the attribute from 0.
Returns:
The NV or a null if it doesn't exist.

getAttributeNames

java.util.Collection<java.lang.String> getAttributeNames()
Get a collection of attribute names.

Returns:
The collection.

getAttributeCount

int getAttributeCount()
Get the total attribute count.

Returns:
count, zero or greater

getAttributeCount

int getAttributeCount(java.lang.String n)
Get the total attribute count for a specific name. It will return 0 if the name is not found.

Parameters:
n - The name of the attribute.
Returns:
count, zero or greater

getPrivateSet

Attributes getPrivateSet()
Get a private set that can be manipulated. This will make a copy and will not affect the original.

Returns:
the HashSet of attributes.


Things.