javax.naming.directory
public class: ModificationItem [javadoc |
source]
java.lang.Object
javax.naming.directory.ModificationItem
All Implemented Interfaces:
Serializable
This class represents a modification item.
It consists of a modification code and an attribute on which to operate.
A ModificationItem instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify
a single ModificationItem instance should lock the object.
- author:
Rosanna - Lee
- author:
Scott - Seligman
- since:
1.3 -
| Constructor: |
public ModificationItem(int mod_op,
Attribute attr) {
switch (mod_op) {
case DirContext.ADD_ATTRIBUTE:
case DirContext.REPLACE_ATTRIBUTE:
case DirContext.REMOVE_ATTRIBUTE:
if (attr == null)
throw new IllegalArgumentException("Must specify non-null attribute for modification");
this.mod_op = mod_op;
this.attr = attr;
break;
default:
throw new IllegalArgumentException("Invalid modification code " + mod_op);
}
}
Creates a new instance of ModificationItem. Parameters:
mod_op - Modification to apply. It must be one of:
DirContext.ADD_ATTRIBUTE
DirContext.REPLACE_ATTRIBUTE
DirContext.REMOVE_ATTRIBUTE
attr - The non-null attribute to use for modification.
Throws:
IllegalArgumentException - If attr is null, or if mod_op is
not one of the ones specified above.
- exception:
IllegalArgumentException - If attr is null, or if mod_op is
not one of the ones specified above.
|
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.naming.directory.ModificationItem Detail: |
public Attribute getAttribute() {
return attr;
}
Retrieves the attribute associated with this modification item. |
public int getModificationOp() {
return mod_op;
}
Retrieves the modification code of this modification item. |
public String toString() {
switch (mod_op) {
case DirContext.ADD_ATTRIBUTE:
return ("Add attribute: " + attr.toString());
case DirContext.REPLACE_ATTRIBUTE:
return ("Replace attribute: " + attr.toString());
case DirContext.REMOVE_ATTRIBUTE:
return ("Remove attribute: " + attr.toString());
}
return ""; // should never happen
}
Generates the string representation of this modification item,
which consists of the modification operation and its related attribute.
The string representation is meant for debugging and not to be
interpreted programmatically. |