Top Description Fields Constructors Methods
org.apache.catalina.util

public final Class ResourceSet<T>

extends HashSet<T>
Class Inheritance
Type Parameters
<T>
The type of elements in the Set
Imports
java.util.Collection, .HashSet, org.apache.tomcat.util.res.StringManager

Extended implementation of HashSet that includes a locked property. This class can be used to safely expose resource path sets to user classes without having to clone them in order to avoid modifications. When first created, a ResourceMap is not locked.
Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
private boolean
locked

The current lock state of this parameter map.

private static final long
private static final StringManager
sm

The string manager for this package.

Constructor Summary

AccessConstructor and Description
public
ResourceSet()

Construct a new, empty set with the default initial capacity and load factor.

public
ResourceSet(int
The initial capacity of this set
initialCapacity
)

Construct a new, empty set with the specified initial capacity and default load factor.

public
ResourceSet(int
The initial capacity of this set
initialCapacity
,
float
The load factor of this set
loadFactor
)

Construct a new, empty set with the specified initial capacity and load factor.

public
ResourceSet(Collection<T>
The collection whose contents we should copy
coll
)

Construct a new set with the same contents as the existing collection.

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T
The object to be added
o
)

Overrides java.util.HashSet.add.

Implements java.util.Set.add, java.util.Collection.add.

Add the specified element to this set if it is not already present.

public void
clear()

Overrides java.util.HashSet.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Remove all of the elements from this set.

public boolean

Returns:

the locked state of this parameter map.
isLocked
()

public boolean
remove(Object
The object to be removed
o
)

Overrides java.util.HashSet.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Remove the given element from this set if it is present.

public void
setLocked(boolean
The new locked state
locked
)

Set the locked state of this parameter map.

Inherited from java.util.HashSet:
clonecontainsisEmptyiteratornewHashSetsizespliteratortoArraytoArray

Field Detail

lockedback to summary
private boolean locked

The current lock state of this parameter map.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.HashSet.serialVersionUID.

smback to summary
private static final StringManager sm

The string manager for this package.

Constructor Detail

ResourceSetback to summary
public ResourceSet()

Construct a new, empty set with the default initial capacity and load factor.

ResourceSetback to summary
public ResourceSet(int initialCapacity)

Construct a new, empty set with the specified initial capacity and default load factor.

Parameters
initialCapacity:int

The initial capacity of this set

ResourceSetback to summary
public ResourceSet(int initialCapacity, float loadFactor)

Construct a new, empty set with the specified initial capacity and load factor.

Parameters
initialCapacity:int

The initial capacity of this set

loadFactor:float

The load factor of this set

ResourceSetback to summary
public ResourceSet(Collection<T> coll)

Construct a new set with the same contents as the existing collection.

Parameters
coll:Collection<T>

The collection whose contents we should copy

Method Detail

addback to summary
public boolean add(T o)

Overrides java.util.HashSet.add.

Implements java.util.Set.add, java.util.Collection.add.

Add the specified element to this set if it is not already present. Return true if the element was added.

Parameters
o:T

The object to be added

Returns:boolean

Doc from java.util.HashSet.add.

true if this set did not already contain the specified element

Annotations
@Override
Exceptions
IllegalStateException:
if this ResourceSet is locked
clearback to summary
public void clear()

Overrides java.util.HashSet.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Remove all of the elements from this set.

Annotations
@Override
Exceptions
IllegalStateException:
if this ResourceSet is locked
isLockedback to summary
public boolean isLocked()
Returns:boolean

the locked state of this parameter map.

removeback to summary
public boolean remove(Object o)

Overrides java.util.HashSet.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Remove the given element from this set if it is present. Return true if the element was removed.

Parameters
o:Object

The object to be removed

Returns:boolean

Doc from java.util.HashSet.remove.

true if the set contained the specified element

Annotations
@Override
Exceptions
IllegalStateException:
if this ResourceSet is locked
setLockedback to summary
public void setLocked(boolean locked)

Set the locked state of this parameter map.

Parameters
locked:boolean

The new locked state