Class ImmutableScope

  • All Implemented Interfaces:
    Scope, Serializable

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableScope
    extends Object
    implements Scope
    Immutable implementation of Scope.

    Use the builder to create immutable instances: ImmutableScope.builder(). Use the static factory method to create immutable instances: ImmutableScope.of().

    See Also:
    Serialized Form
    • Method Detail

      • getScopeId

        public ItemId getScopeId()
        Specified by:
        getScopeId in interface Scope
        Returns:
        The value of the scopeId attribute
      • getScopeItems

        public com.google.common.collect.ImmutableSet<ItemId> getScopeItems()
        Specified by:
        getScopeItems in interface Scope
        Returns:
        The value of the scopeItems attribute
      • withScopeId

        public final ImmutableScope withScopeId​(ItemId value)
        Copy the current immutable object by setting a value for the scopeId attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for scopeId
        Returns:
        A modified copy of the this object
      • withScopeItems

        public final ImmutableScope withScopeItems​(ItemId... elements)
        Copy the current immutable object with elements that replace the content of scopeItems.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withScopeItems

        public final ImmutableScope withScopeItems​(Iterable<? extends ItemId> elements)
        Copy the current immutable object with elements that replace the content of scopeItems. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of scopeItems elements to set
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableScope that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: scopeId, scopeItems.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value Scope with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • of

        public static ImmutableScope of​(ItemId scopeId,
                                        Set<ItemId> scopeItems)
        Construct a new immutable Scope instance.
        Parameters:
        scopeId - The value for the scopeId attribute
        scopeItems - The value for the scopeItems attribute
        Returns:
        An immutable Scope instance
      • of

        public static ImmutableScope of​(ItemId scopeId,
                                        Iterable<? extends ItemId> scopeItems)
        Construct a new immutable Scope instance.
        Parameters:
        scopeId - The value for the scopeId attribute
        scopeItems - The value for the scopeItems attribute
        Returns:
        An immutable Scope instance
      • copyOf

        public static ImmutableScope copyOf​(Scope instance)
        Creates an immutable copy of a Scope value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable Scope instance
      • builder

        public static ImmutableScope.Builder builder()
        Creates a builder for ImmutableScope.
         ImmutableScope.builder()
            .scopeId(io.dialob.executor.model.ItemId) // required scopeId
            .addScopeItems|addAllScopeItems(io.dialob.executor.model.ItemId) // scopeItems elements
            .build();
         
        Returns:
        A new ImmutableScope builder