APIdia Launch Partner
Top Description Fields Constructors Methods
javax.management.relation

public Class RoleList

extends ArrayList<Object>
Class Inheritance
Imports
com.sun.jmx.mbeanserver.Util, java.util.ArrayList, .Collection, .List

A RoleList represents a list of roles (Role objects). It is used as parameter when creating a relation, and when trying to set several roles in a relation (via 'setRoles()' method). It is returned as part of a RoleResult, to provide roles successfully retrieved.

It is not permitted to add objects to a RoleList that are not instances of Role. This will produce an IllegalArgumentException when calling methods in this class, or when using listIterator and add or set.

Since
1.5

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
RoleList()

Constructs an empty RoleList.

public
RoleList(int
initial capacity
initialCapacity
)

Constructs an empty RoleList with the initial capacity specified.

public
RoleList(List<Role>
the List that defines the initial contents of the new RoleList.
list
)

Constructs a RoleList containing the elements of the List specified, in the order in which they are returned by the List's iterator.

Method Summary

Modifier and TypeMethod and Description
public void
add(Role
the role to be added.
role
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Adds the Role specified as the last element of the list.

public void
add(int
The position in the list where the new Role object is to be inserted.
index
,
Role
The Role object to be inserted.
role
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the role specified as an element at the position specified.

public boolean
add(Object o)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list.

public void
add(int index, Object element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list.

public boolean

Returns:

true if this list changed as a result of the call.
addAll
(RoleList
Elements to be inserted into the list (can be null)
roleList
)

Appends all the elements in the RoleList specified to the end of the list, in the order in which they are returned by the Iterator of the RoleList specified.

public boolean

Returns:

true if this list changed as a result of the call.
addAll
(int
Position at which to insert the first element from the RoleList specified.
index
,
RoleList
Elements to be inserted into the list.
roleList
)

Inserts all of the elements in the RoleList specified into this list, starting at the specified position, in the order in which they are returned by the Iterator of the RoleList specified.

public boolean
addAll(Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.

public boolean
addAll(int index, Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position.

public List<Role>

Returns:

a List<Role> whose contents reflect the contents of this RoleList.
asList
()

Return a view of this list as a List<Role>.

private static void
checkTypeSafe(Object o)

IllegalArgumentException if o is a non-Role object.

private static void
checkTypeSafe(Collection<?> c)

IllegalArgumentException if c contains any non-Role objects.

public void
set(int
The position specified.
index
,
Role
The value to which the role element should be set.
role
)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Sets the element at the position specified to be the role specified.

public Object
set(int index, Object element)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element.

Inherited from java.util.ArrayList:
addFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.ArrayList.serialVersionUID.

Constructor Detail

RoleListback to summary
public RoleList()

Constructs an empty RoleList.

RoleListback to summary
public RoleList(int initialCapacity)

Constructs an empty RoleList with the initial capacity specified.

Parameters
initialCapacity:int

initial capacity

RoleListback to summary
public RoleList(List<Role> list) throws IllegalArgumentException

Constructs a RoleList containing the elements of the List specified, in the order in which they are returned by the List's iterator. The RoleList instance has an initial capacity of 110% of the size of the List specified.

Parameters
list:List<Role>

the List that defines the initial contents of the new RoleList.

Exceptions
IllegalArgumentException:
if the list parameter is null or if the list parameter contains any non-Role objects.
See Also
ArrayList#ArrayList(java.util.Collection)

Method Detail

addback to summary
public void add(Role role) throws IllegalArgumentException

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Adds the Role specified as the last element of the list.

Parameters
role:Role

the role to be added.

Exceptions
IllegalArgumentException:
if the role is null.
addback to summary
public void add(int index, Role role) throws IllegalArgumentException, IndexOutOfBoundsException

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the role specified as an element at the position specified. Elements with an index greater than or equal to the current position are shifted up.

Parameters
index:int

The position in the list where the new Role object is to be inserted.

role:Role

The Role object to be inserted.

Exceptions
IllegalArgumentException:
if the role is null.
IndexOutOfBoundsException:
if accessing with an index outside of the list.
addback to summary
public boolean add(Object o)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.ArrayList.add.

Appends the specified element to the end of this list.

Annotations
@Override
Exceptions
IllegalArgumentException:
if o is not a Role.
addback to summary
public void add(int index, Object element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Doc from java.util.ArrayList.add.

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Annotations
@Override
Exceptions
IllegalArgumentException:
if element is not a Role.
addAllback to summary
public boolean addAll(RoleList roleList) throws IndexOutOfBoundsException

Appends all the elements in the RoleList specified to the end of the list, in the order in which they are returned by the Iterator of the RoleList specified.

Parameters
roleList:RoleList

Elements to be inserted into the list (can be null)

Returns:boolean

true if this list changed as a result of the call.

Exceptions
IndexOutOfBoundsException:
if accessing with an index outside of the list.
See Also
ArrayList#addAll(Collection)
addAllback to summary
public boolean addAll(int index, RoleList roleList) throws IllegalArgumentException, IndexOutOfBoundsException

Inserts all of the elements in the RoleList specified into this list, starting at the specified position, in the order in which they are returned by the Iterator of the RoleList specified.

Parameters
index:int

Position at which to insert the first element from the RoleList specified.

roleList:RoleList

Elements to be inserted into the list.

Returns:boolean

true if this list changed as a result of the call.

Exceptions
IllegalArgumentException:
if the role is null.
IndexOutOfBoundsException:
if accessing with an index outside of the list.
See Also
ArrayList#addAll(int, Collection)
addAllback to summary
public boolean addAll(Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Doc from java.util.ArrayList.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)

Annotations
@Override
Exceptions
IllegalArgumentException:
if c contains a member that is not a Role.
addAllback to summary
public boolean addAll(int index, Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Doc from java.util.ArrayList.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

Annotations
@Override
Exceptions
IllegalArgumentException:
if c contains a member that is not a Role.
asListback to summary
public List<Role> asList()

Return a view of this list as a List<Role>. Changes to the returned value are reflected by changes to the original RoleList and vice versa.

Returns:List<Role>

a List<Role> whose contents reflect the contents of this RoleList.

Exceptions
IllegalArgumentException:
if this RoleList contains an element that is not a Role.
Since
1.6
checkTypeSafeback to summary
private static void checkTypeSafe(Object o)

IllegalArgumentException if o is a non-Role object.

checkTypeSafeback to summary
private static void checkTypeSafe(Collection<?> c)

IllegalArgumentException if c contains any non-Role objects.

setback to summary
public void set(int index, Role role) throws IllegalArgumentException, IndexOutOfBoundsException

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Sets the element at the position specified to be the role specified. The previous element at that position is discarded.

Parameters
index:int

The position specified.

role:Role

The value to which the role element should be set.

Exceptions
IllegalArgumentException:
if the role is null.
IndexOutOfBoundsException:
if accessing with an index outside of the list.
setback to summary
public Object set(int index, Object element)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Doc from java.util.ArrayList.set.

Replaces the element at the specified position in this list with the specified element.

Annotations
@Override
Exceptions
IllegalArgumentException:
if element is not a Role.