Class SimpleRelatedObjectSet
- java.lang.Object
-
- org.apache.guacamole.net.auth.simple.SimpleRelatedObjectSet
-
- All Implemented Interfaces:
RelatedObjectSet
public class SimpleRelatedObjectSet extends Object implements RelatedObjectSet
A read-only implementation of RelatedObjectSet which uses a backing Set of identifiers to determine which objects are present.
-
-
Field Summary
-
Fields inherited from interface org.apache.guacamole.net.auth.RelatedObjectSet
EMPTY_SET
-
-
Constructor Summary
Constructors Constructor Description SimpleRelatedObjectSet()
Creates a new empty SimpleRelatedObjectSet.SimpleRelatedObjectSet(Set<String> identifiers)
Creates a new SimpleRelatedObjectSet which contains the objects having the identifiers within the given Set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObjects(Set<String> identifiers)
Adds the objects having the given identifiers, if not already present.Set<String>
getObjects()
Returns a Set which contains the identifiers of all objects contained within this RelatedObjectSet.void
removeObjects(Set<String> identifiers)
Removes each of the objects having the specified identifiers, if present.protected void
setObjects(Set<String> identifiers)
Replaces the Set of object identifiers which backs this SimpleRelatedObjectSet.
-
-
-
Constructor Detail
-
SimpleRelatedObjectSet
public SimpleRelatedObjectSet()
Creates a new empty SimpleRelatedObjectSet. If you are not extending SimpleRelatedObjectSet and only need an immutable, empty RelatedObjectSet, consider usingRelatedObjectSet.EMPTY_SET
instead.
-
SimpleRelatedObjectSet
public SimpleRelatedObjectSet(Set<String> identifiers)
Creates a new SimpleRelatedObjectSet which contains the objects having the identifiers within the given Set. The given Set backs the contents of the new SimpleRelatedObjectSet. While the SimpleRelatedObjectSet is read-only, any changes to the underlying Set will be reflected in the SimpleRelatedObjectSet.- Parameters:
identifiers
- The Set containing the identifiers of all objects which should be present within the new SimpleRelatedObjectSet.
-
-
Method Detail
-
setObjects
protected void setObjects(Set<String> identifiers)
Replaces the Set of object identifiers which backs this SimpleRelatedObjectSet. Future function calls on this SimpleRelatedObjectSet will instead use the provided Set.- Parameters:
identifiers
- The Set containing the identifiers of all objects which should be present within this SimpleRelatedObjectSet.
-
getObjects
public Set<String> getObjects()
Description copied from interface:RelatedObjectSet
Returns a Set which contains the identifiers of all objects contained within this RelatedObjectSet.- Specified by:
getObjects
in interfaceRelatedObjectSet
- Returns:
- A Set which contains the identifiers of all objects contained within this RelatedObjectSet.
-
addObjects
public void addObjects(Set<String> identifiers) throws org.apache.guacamole.GuacamoleException
Description copied from interface:RelatedObjectSet
Adds the objects having the given identifiers, if not already present. If a specified object is already present, no operation is performed regarding that object.- Specified by:
addObjects
in interfaceRelatedObjectSet
- Parameters:
identifiers
- The identifiers of all objects being added.- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while adding the objects, or if permission to add objects is denied.
-
removeObjects
public void removeObjects(Set<String> identifiers) throws org.apache.guacamole.GuacamoleException
Description copied from interface:RelatedObjectSet
Removes each of the objects having the specified identifiers, if present. If a specified object is not present, no operation is performed regarding that object.- Specified by:
removeObjects
in interfaceRelatedObjectSet
- Parameters:
identifiers
- The identifiers of all objects being removed.- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while removing the objects, or if permission to remove objects is denied.
-
-