Class 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.
    • Constructor Detail

      • SimpleRelatedObjectSet

        public SimpleRelatedObjectSet()
        Creates a new empty SimpleRelatedObjectSet. If you are not extending SimpleRelatedObjectSet and only need an immutable, empty RelatedObjectSet, consider using RelatedObjectSet.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 interface RelatedObjectSet
        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 interface RelatedObjectSet
        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 interface RelatedObjectSet
        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.