For compatibility reasons, it is possible, though
highly discouraged, to add objects to an {@code AttributeList} that are
not instances of {@code Attribute}. However, an {@code AttributeList}
can be made type-safe, which means that an attempt to add
an object that is not an {@code Attribute} will produce an {@code
IllegalArgumentException}. An {@code AttributeList} becomes type-safe
when the method #asList() is called on it.
Method from javax.management.AttributeList Detail: |
public void add(Attribute object) {
super.add(object);
}
Adds the {@code Attribute} specified as the last element of the list. |
public boolean add(Object element) {
adding(element);
return super.add(element);
}
|
public void add(int index,
Attribute object) {
try {
super.add(index, object);
}
catch (IndexOutOfBoundsException e) {
throw new RuntimeOperationsException(e,
"The specified index is out of range");
}
}
Inserts the attribute specified as an element at the position specified.
Elements with an index greater than or equal to the current position are
shifted up. If the index is out of range (index < 0 || index >
size()) a RuntimeOperationsException should be raised, wrapping the
java.lang.IndexOutOfBoundsException thrown. |
public void add(int index,
Object element) {
adding(element);
super.add(index, element);
}
|
public boolean addAll(AttributeList list) {
return (super.addAll(list));
}
Appends all the elements in the AttributeList specified to
the end of the list, in the order in which they are returned by the
Iterator of the AttributeList specified. |
public boolean addAll(Collection<?> c) {
adding(c);
return super.addAll(c);
}
|
public boolean addAll(int index,
AttributeList list) {
try {
return super.addAll(index, list);
} catch (IndexOutOfBoundsException e) {
throw new RuntimeOperationsException(e,
"The specified index is out of range");
}
}
Inserts all of the elements in the AttributeList specified
into this list, starting at the specified position, in the order in which
they are returned by the Iterator of the {@code AttributeList} specified.
If the index is out of range (index < 0 || index > size() a
RuntimeOperationsException should be raised, wrapping the
java.lang.IndexOutOfBoundsException thrown. |
public boolean addAll(int index,
Collection<?> c) {
adding(c);
return super.addAll(index, c);
}
|
public List<Attribute> asList() {
typeSafe = true;
if (tainted)
adding((Collection< ? >) this); // will throw IllegalArgumentException
return (List< Attribute >) (List< ? >) this;
}
Return a view of this list as a {@code List}.
Changes to the returned value are reflected by changes
to the original {@code AttributeList} and vice versa. |
public void set(int index,
Attribute object) {
try {
super.set(index, object);
}
catch (IndexOutOfBoundsException e) {
throw new RuntimeOperationsException(e,
"The specified index is out of range");
}
}
Sets the element at the position specified to be the attribute specified.
The previous element at that position is discarded. If the index is
out of range (index < 0 || index > size() a RuntimeOperationsException
should be raised, wrapping the java.lang.IndexOutOfBoundsException thrown. |
public Object set(int index,
Object element) {
adding(element);
return super.set(index, element);
}
|