|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.entry.Attribute
public class Attribute
The Attribute class is used in conjunction with the Entry object to store information about an attribute. The attribute has a name and a list of zero or more values. Each value can be any type of Java object so you can add values of any kind to the attribute.
Field Summary | |
---|---|
static char |
ATTRIBUTE_ADD
Add value |
static char |
ATTRIBUTE_DELETE
Delete value |
static char |
ATTRIBUTE_MOD
Values modified |
static char |
ATTRIBUTE_REPLACE
Replace value |
static char |
ATTRIBUTE_UNCHANGED
Unchanged |
static String[] |
OPER
|
Constructor Summary | |
---|---|
Attribute()
Initialize this attribute with no name, no values and the operation code set to ATTRIBUTE_REPLACE. |
|
Attribute(String name)
Initializes this attribute with no values and the operation code set to ATTRIBUTE_REPLACE, the name is set to name. |
|
Attribute(String name,
Object value)
Initializes this attribute with operation code set to ATTRIBUTE_REPLACE, the name is set to name and the value value is added to the list of values. |
Method Summary | |
---|---|
void |
addValue(Object p1)
Adds a value to the attribute's list of values. |
void |
addValue(Object p1,
int valueOper)
Adds a value to this Attribute's list of values. |
Attribute |
addValues(Attribute attr)
Add the values in another Attribute to this Attribute. |
void |
clear()
Removes all values from this attribute and sets the operation to ATTRIBUTE_REPLACE. |
Object |
clone()
Returns a clone of this object. |
boolean |
contains(Object value)
Checks if a value is contained in this Attribute. |
String |
getName()
Returns this Attribute's name. |
char |
getOper()
Returns the operation type of this Attribute. |
String |
getOperation()
Returns the operation type of this Attribute as a String. |
boolean |
getProtected()
Returns the protected value of this Attribute |
String |
getValue()
Returns the first value, if any, as a String object. |
Object |
getValue(int index)
Returns the value at the position given by index. |
Object |
getValueAV(int index)
Returns the object at index. |
int |
getValueOper(int index)
Returns the value operation code at a specified index as an integer. |
String |
getValueOperation(int index)
Returns the operation code as a string (add, delete, unchanged) for a given index. |
Object[] |
getValues()
Returns this attribute's values as an array of objects. |
Object[] |
getValuesAV()
Returns this Attribute's values as an array of objects. |
Vector |
getValuesVector()
Returns this Attribute's values as a Vector. |
boolean |
hasValue(Object value)
Checks if a value is contained in this Attribute. |
boolean |
hasValueIC(String value)
Checks if a string value is contained in this attribute. |
boolean |
removeValue(Object p1)
Removes all instances of a value from the attribute's list of values. |
Object |
removeValueAt(int index)
Removes a value at a given index |
void |
setName(String name)
Sets this Attribute's name. |
void |
setOper(char operation)
Sets the operation type of this Attribute. |
void |
setOperation(String operation)
Sets the operation type of this Attribute. |
Attribute |
setProtected(boolean protect)
Sets the protected value of this Attribute |
void |
setValue(int index,
Object value)
Sets the attribute's value at a specific position to the value specified. |
void |
setValue(int position,
Object p2,
int valueOper)
Sets the attribute's value at a specific position to the value specified. |
void |
setValue(Object p1)
Sets this Attribute's value at position 0 to the value specified. |
void |
setValue(Object p1,
int valueOper)
Sets this Attribute's value at position 0 to the value specified. |
void |
setValueOper(int index,
int valueOper)
Sets the value operation code. |
void |
setValueOperation(int index,
String valueOper)
Sets the value operation code for a specified index. |
void |
setValues(Object[] values)
Sets the Attribute's values to the array of objects provided by values. |
void |
setValues(Vector values)
Sets this Attribute's values using the Vector passed to it. |
int |
size()
Returns the number of values contained in this Attribute. |
String |
toDeltaString()
Returns the Delta string representation of this Attribute. |
String |
toString()
Returns the string representation of this attribute. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char ATTRIBUTE_REPLACE
public static final char ATTRIBUTE_ADD
public static final char ATTRIBUTE_DELETE
public static final char ATTRIBUTE_UNCHANGED
public static final char ATTRIBUTE_MOD
public static final String[] OPER
Constructor Detail |
---|
public Attribute()
public Attribute(String name)
name
- The attribute namepublic Attribute(String name, Object value)
name
- The attribute namevalue
- The attribute valueMethod Detail |
---|
public Object clone()
clone
in class Object
public void clear()
public boolean hasValue(Object value)
value
- The value to check for
contains(java.lang.Object)
public boolean hasValueIC(String value)
JavaScript example:
if ( conn.hasValueIC("this value") ) { task.logmsg( "It is there" ); }
value
- The string value to check for
public boolean contains(Object value)
contains
in interface AttributeInterface
value
- The value to check for
public String getValue()
getValue
in interface AttributeInterface
public Object getValue(int index)
JavaScript example
var v = conn.getAttribute("attrname").getValue ( 0 ); task.logmsg( "Java class of v is: " + v.getClass().getName() ); task.logmsg( "String representation: " + v.toString() ); if ( v.getClass().getName() == "java.util.Date" ) { task.logmsg("Date object: " + v.getMonth(); }
getValue
in interface AttributeInterface
index
- The position
size()
public Object getValueAV(int index)
getValueAV
in interface AttributeInterface
index
- The position
public Object[] getValues()
getValues
in interface AttributeInterface
public Vector getValuesVector()
getValues()
public Object[] getValuesAV()
public void setValues(Vector values)
values
- The new value array (Vector)public void setValues(Object[] values)
values
- The new value arraypublic void setValue(Object p1)
setValue
in interface AttributeInterface
p1
- The new valuepublic void addValue(Object p1)
addValue
in interface AttributeInterface
p1
- The new valuepublic void setValue(int index, Object value)
setValue
in interface AttributeInterface
index
- The positionvalue
- The value
ArrayIndexOutOfBoundsException
- if the index was invalid.public boolean removeValue(Object p1)
removeValue
in interface AttributeInterface
p1
- The value to remove
public Object removeValueAt(int index)
index
- The index of the value to remove
public String getName()
getName
in interface AttributeInterface
public void setName(String name)
setName
in interface AttributeInterface
name
- The new name of this Attributepublic char getOper()
getOper
in interface AttributeInterface
public String getOperation()
public void setOper(char operation)
setOper
in interface AttributeInterface
operation
- The operation type as a charpublic void setOperation(String operation)
operation
- The operation type as a stringpublic int size()
size
in interface AttributeInterface
public String toString()
toString
in class Object
public String toDeltaString()
public void setValue(Object p1, int valueOper)
p1
- The new valuevalueOper
- The value operation codepublic void setValue(int position, Object p2, int valueOper)
position
- The positionp2
- The valuevalueOper
- The value operation code
ArrayIndexOutOfBoundsException
- if the position was invalid.public void addValue(Object p1, int valueOper)
p1
- The new valuevalueOper
- The value operation codepublic void setValueOper(int index, int valueOper)
index
- The value indexvalueOper
- The value operation codepublic int getValueOper(int index)
index
- The value index
public void setValueOperation(int index, String valueOper)
index
- The new valuevalueOper
- The string-version operation codepublic String getValueOperation(int index)
index
- The indexpublic Attribute setProtected(boolean protect)
setProtected
in interface AttributeInterface
protect
- - If true, try to protect the Attribute values by not dumping them in log files
public boolean getProtected()
getProtected
in interface AttributeInterface
public Attribute addValues(Attribute attr)
attr
- The Attribute from which values are collected
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |