com.infoengine.connector
Class Attribute

java.lang.Object
  extended bycom.infoengine.connector.Data
      extended bycom.infoengine.connector.Attribute
All Implemented Interfaces:
Serializable

public class Attribute
extends Data

represents Info*Engine attribute data
Attributes have names and can contain one or more Objects as values.
Attributes are contained within Elements. The concept of State here is simply a place holder for Info*Engine attribute state information. If state for an attribute value is non-null then the state value should be the external form of a State object. If this group was generated as the result of deserializing Info*Engine XML and the state for an attribute value is non-null then the state value will be the external form of a State object.

See Also:
Group, Element, Serialized Form

Nested Class Summary
(package private)  class Attribute.AttributeValueHolder
           
 
Field Summary
private  Vector _values
           
private  String name
           
 
Fields inherited from class com.infoengine.connector.Data
_meta
 
Constructor Summary
Attribute()
          create a new unnamed attribute
Attribute(String name)
          create a new named attribute
Attribute(String name, Object value)
          create a new named attrbute with a value
 
Method Summary
 void addValue(Object value)
          add a value to this attribute.
 void addValue(Object value, String state)
          add a value with a state to this attribute
 boolean equals(Object other)
          test this attribute against another for equality
 String getName()
          get this attribute's name
 int getSize()
          return the number of values this attribute has
 String getState()
          retrieve the state of the first attribute value
 String getStateAt(int index)
          retrieve the state of a specific attribute by index
 Object getValue()
          get the value of this attribute.
 Object getValueAt(int index)
          get an attribute value by index
 Enumeration getValues()
          get an Enumeration of this attributes values.
 int hashCode()
          generate this attribute's hashCode
the value is based on attribute name, all its values and metadata.
 void setState(String state)
          set the state of the first attribute value
 void setStateAt(String state, int index)
          set the state of an attribute value by index.
 void setValue(Object value)
          set this attributes value.
 void setValueAt(Object value, int index)
          set an attribute value by index.
 String toString()
          return a String representation of this Attribute (resembles XML useful for debugging only)
 
Methods inherited from class com.infoengine.connector.Data
addMetaValue, getMetaNames, getMetaValue, getMetaValues, removeMetaValues, setMetaValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private String name

_values

private Vector _values
Constructor Detail

Attribute

public Attribute()
create a new unnamed attribute


Attribute

public Attribute(String name)
create a new named attribute

Parameters:
name - attribute name

Attribute

public Attribute(String name,
                 Object value)
create a new named attrbute with a value

Parameters:
name - attribute name
value - attribute value
Method Detail

setValue

public void setValue(Object value)
set this attributes value. all other value(s) will be replaced with the single new value.

Parameters:
value - the new value

addValue

public void addValue(Object value)
add a value to this attribute.

Parameters:
value - a new value to add

addValue

public void addValue(Object value,
                     String state)
add a value with a state to this attribute

Parameters:
value - a new value to add
state - the state of that value

getValue

public Object getValue()
get the value of this attribute. if the attribute is multi-valued then the first value is returned.

Returns:
Object or null if no value

getValues

public Enumeration getValues()
get an Enumeration of this attributes values.

Returns:
Enumeration

getSize

public int getSize()
return the number of values this attribute has

Returns:
int

getValueAt

public Object getValueAt(int index)
get an attribute value by index

Parameters:
index - the index of the value to retrieve
Returns:
Object the value at index or null if invalid index.

setValueAt

public void setValueAt(Object value,
                       int index)
set an attribute value by index. if index is greater than the number of current attributes then the result is the same as calling addValue.

Parameters:
value - the value to set
index - the index to replace

getName

public String getName()
get this attribute's name

Returns:
String

getState

public String getState()
retrieve the state of the first attribute value

Returns:
String

getStateAt

public String getStateAt(int index)
retrieve the state of a specific attribute by index

Returns:
String or null if null state or invalid index

setState

public void setState(String state)
set the state of the first attribute value

Parameters:
state - the new attribute state

setStateAt

public void setStateAt(String state,
                       int index)
set the state of an attribute value by index. the call is ignored if index is invalid

Parameters:
state - the new attribute state
index - the attribute index

equals

public boolean equals(Object other)
test this attribute against another for equality

Overrides:
equals in class Data
Returns:
boolean

hashCode

public int hashCode()
generate this attribute's hashCode
the value is based on attribute name, all its values and metadata.

Overrides:
hashCode in class Data
Returns:
int

toString

public String toString()
return a String representation of this Attribute (resembles XML useful for debugging only)

Returns:
String