Class ImmutableLabel

  • All Implemented Interfaces:
    Label, ProgramNode, Serializable

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

    Use the builder to create immutable instances: ImmutableLabel.builder().

    See Also:
    Serialized Form
    • Method Detail

      • getLabels

        public com.google.common.collect.ImmutableMap<String,​String> getLabels()
        Specified by:
        getLabels in interface Label
        Returns:
        The value of the labels attribute
      • withLabels

        public final ImmutableLabel withLabels​(Map<String,​? extends String> entries)
        Copy the current immutable object by replacing the labels map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        entries - The entries to be added to the labels map
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableLabel 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: labels.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

        public static ImmutableLabel copyOf​(Label instance)
        Creates an immutable copy of a Label 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 Label instance
      • builder

        public static ImmutableLabel.Builder builder()
        Creates a builder for ImmutableLabel.
         ImmutableLabel.builder()
            .putLabels|putAllLabels(String => String) // labels mappings
            .build();
         
        Returns:
        A new ImmutableLabel builder