serf.data
Class Attribute

java.lang.Object
  extended by serf.data.Attribute
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<java.lang.String>

public class Attribute
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Iterable<java.lang.String>

This class represents the attributes associated with a record. An attribute has a type and one or more values associated with it.


Constructor Summary
Attribute(java.lang.String type)
           
Attribute(java.lang.String type, java.lang.String... values)
           
 
Method Summary
 void addValue(java.lang.String text)
          Adds a value for this attribute.
 void addValues(java.util.Collection<java.lang.String> values)
          Adds a set of values to this attribute
 void clear()
          Removes all the attribute values
 Attribute clone()
           
 boolean equals(java.lang.Object o)
          Test this object for equality with another object.
 java.lang.String getType()
          Get the type of this attribute.
 int getValuesCount()
          Gets the number of values for this attribute
 int hashCode()
           
 java.util.Iterator<java.lang.String> iterator()
          Retrieves an iterator for this attribute's values.
 void setType(java.lang.String type)
          Sets the attribute type
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute(java.lang.String type)

Attribute

public Attribute(java.lang.String type,
                 java.lang.String... values)
Method Detail

clone

public Attribute clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getType

public java.lang.String getType()
Get the type of this attribute.

Returns:
The attribute type as given by the data source.

setType

public void setType(java.lang.String type)
Sets the attribute type

Parameters:
type - The new attribute type

iterator

public java.util.Iterator<java.lang.String> iterator()
Retrieves an iterator for this attribute's values.

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>
Returns:
Attribute values iterator.

getValuesCount

public int getValuesCount()
Gets the number of values for this attribute

Returns:
The number of values for this attribute

addValue

public void addValue(java.lang.String text)
Adds a value for this attribute.

Parameters:
value - The new attribute value.

addValues

public void addValues(java.util.Collection<java.lang.String> values)
Adds a set of values to this attribute

Parameters:
values - the new values

clear

public void clear()
Removes all the attribute values


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Test this object for equality with another object.

Overrides:
equals in class java.lang.Object
Parameters:
object -
Returns:
true if this and object have the same type and value