Class SessionOwnershipRecord.Builder

  • Enclosing class:
    SessionOwnershipRecord

    public static final class SessionOwnershipRecord.Builder
    extends Object

    Builder of Session Ownership Records.

    Since:
    Rhino 2.6.1
    • Method Detail

      • getPrimaryKey

        public String getPrimaryKey()

        Get the primary key of the record to be built.

        Returns:
        the primary key, or an empty string if a primary key has not yet been set.
        Since:
        Rhino 2.6.1
      • setPrimaryKey

        public SessionOwnershipRecord.Builder setPrimaryKey​(String primaryKey)

        Set the primary key for the record to be built. The primary key cannot be null.

        Parameters:
        primaryKey - the primary key.
        Returns:
        this builder.
        Throws:
        NullPointerException - if primaryKey is null.
        Since:
        Rhino 2.6.1
      • getAdditionalKeys

        public Set<String> getAdditionalKeys()

        Get the current set of additional keys for the record to be built. Changes to the returned set will be reflected in this builder.

        Returns:
        the set of current additional keys.
        Since:
        Rhino 2.6.1
      • setAdditionalKeys

        public SessionOwnershipRecord.Builder setAdditionalKeys​(Set<String> additionalKeys)

        Set the set of additional keys for the record to be built. The set may not contain null elements.

        Parameters:
        additionalKeys - a set of additional keys. This set will replace the set currently maintained by the builder.
        Returns:
        this builder.
        Throws:
        NullPointerException - if additionalKeys is null.
        IllegalArgumentException - if additionalKeys contains null.elements.
        Since:
        Rhino 2.6.1
      • addAdditionalKey

        public SessionOwnershipRecord.Builder addAdditionalKey​(String additionalKey)

        Add an additional key to the existing set of additional keys for the record to be built.

        Parameters:
        additionalKey - the additional key to add.
        Returns:
        this builder.
        Throws:
        NullPointerException - if additionalKey is null.
        Since:
        Rhino 2.6.1
      • removeAdditionalKey

        public SessionOwnershipRecord.Builder removeAdditionalKey​(String additionalKey)

        Remove an additional key from the set of additional keys for the record to be built.

        Parameters:
        additionalKey - the additional key to remove.
        Returns:
        this builder.
        Since:
        Rhino 2.6.1
      • getSequenceNumber

        public int getSequenceNumber()

        Get the sequence number for the record to be built.

        Returns:
        the sequence number.
        Since:
        Rhino 2.6.1
      • overrideSequenceNumber

        public SessionOwnershipRecord.Builder overrideSequenceNumber​(int sequenceNumber)

        Overrides the generated sequence number for the record to be built.

        Sequence numbers are automatically set when a Builder is created. New builders created from SessionOwnershipRecord.newBuilder() will have a sequence number of 0. Builders created from existing records using SessionOwnershipRecord.toBuilder() will have a sequence number one more than the sequence number of the source record. It is not normally required to replace the generated sequence numbers but this method can be used to do so if necessary.

        Parameters:
        sequenceNumber - the new sequence number.
        Returns:
        this builder.
        Since:
        Rhino 2.6.1
      • getOwnerURIs

        public Set<String> getOwnerURIs()

        Get the set of session owner URIs for the record to be built. Changes to the returned set will be reflected in this builder.

        Returns:
        The set of current session owner URIs.
        Since:
        Rhino 2.6.1
      • setOwnerURIs

        public SessionOwnershipRecord.Builder setOwnerURIs​(Set<String> ownerURIs)

        Set the set of session owner URIs for the record to be built. The set may not contain null elements.

        Parameters:
        ownerURIs - a set of session owner URIs. This set will replace the set currently maintained by the builder.
        Returns:
        this builder.
        Throws:
        NullPointerException - if ownerURIs is null.
        IllegalArgumentException - if ownerURIs contains null.elements.
        Since:
        Rhino 2.6.1
      • addOwnerURI

        public SessionOwnershipRecord.Builder addOwnerURI​(String ownerURI)

        Add a session owner URI to the existing set of owner URIs for the record to be built.

        Parameters:
        ownerURI - the session owner URI to be added.
        Returns:
        this builder.
        Throws:
        NullPointerException - if ownerURI is null.
        Since:
        Rhino 2.6.1
      • removeOwnerURI

        public SessionOwnershipRecord.Builder removeOwnerURI​(String ownerURI)

        Remove a session owner URI from the set of owner URIs for the record to be built..

        Parameters:
        ownerURI - the session owner URI to remove.
        Returns:
        this builder.
        Since:
        Rhino 2.6.2
      • getAttributes

        public Map<String,​String> getAttributes()

        Get the map of all attributes for the record to be built. Changes to the returned map will be reflected in this builder.

        Returns:
        the name to value mappings of all current attributes
        Since:
        Rhino 2.6.1
      • getAttribute

        public String getAttribute​(String name)

        Get the value of the specified attribute from the record to be built.

        Parameters:
        name - the attribute name.
        Returns:
        the attribute value, or null if no such attribute exists.
        Since:
        Rhino 2.6.1
      • setAttributes

        public SessionOwnershipRecord.Builder setAttributes​(Map<String,​String> attributes)

        Set the map of attributes for the record to be built. The map may not contain null keys or values.

        Parameters:
        attributes - a map of attribute name to attribute value. This map will replace the map currently maintained by the builder.
        Returns:
        this builder.
        Throws:
        NullPointerException - if attributes is null.
        IllegalArgumentException - if attributes contains null.keys or values.
        Since:
        Rhino 2.6.1
      • addAttribute

        public SessionOwnershipRecord.Builder addAttribute​(String name,
                                                           String value)

        Add or replace an attribute for the record to be built.

        Parameters:
        name - the name of the attribute.
        value - the attribute’s value.
        Returns:
        this builder.
        Throws:
        NullPointerException - if name or value is null.
        Since:
        Rhino 2.6.1
      • removeAttribute

        public SessionOwnershipRecord.Builder removeAttribute​(String name)

        Remove the attribute with the specified name from the map of attributes for the record to be built..

        Parameters:
        name - the name of the attribute to remove.
        Returns:
        this builder.
        Since:
        Rhino 2.6.1
      • build

        public SessionOwnershipRecord build()

        Create a new immutable SessionOwnershipRecord based on the current values assigned to this builder.

        Returns:
        a new SessionOwnershipRecord with the values from this builder.
        Throws:
        IllegalStateException - if the set of additional keys or owner URIs contains contain a null value, or if the map of attributes contain a null key or value.
        Since:
        Rhino 2.6.1