Class ImmutableService


  • @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableService
    extends Service
    Immutable implementation of Service.

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

    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in class Service
        Returns:
        The value of the id attribute
      • getService

        public java.lang.String getService()
        Specified by:
        getService in class Service
        Returns:
        The value of the service attribute
      • getEnableTagOverride

        public java.util.Optional<java.lang.Boolean> getEnableTagOverride()
        Specified by:
        getEnableTagOverride in class Service
        Returns:
        The value of the enableTagOverride attribute
      • getTags

        public com.google.common.collect.ImmutableList<java.lang.String> getTags()
        Specified by:
        getTags in class Service
        Returns:
        The value of the tags attribute
      • getAddress

        public java.lang.String getAddress()
        Specified by:
        getAddress in class Service
        Returns:
        The value of the address attribute
      • getMeta

        public com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> getMeta()
        Specified by:
        getMeta in class Service
        Returns:
        The value of the meta attribute
      • getPort

        public int getPort()
        Specified by:
        getPort in class Service
        Returns:
        The value of the port attribute
      • getWeights

        public java.util.Optional<ServiceWeights> getWeights()
        Specified by:
        getWeights in class Service
        Returns:
        The value of the weights attribute
      • withId

        public final ImmutableService withId​(java.lang.String value)
        Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for id
        Returns:
        A modified copy of the this object
      • withService

        public final ImmutableService withService​(java.lang.String value)
        Copy the current immutable object by setting a value for the service attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for service
        Returns:
        A modified copy of the this object
      • withEnableTagOverride

        public final ImmutableService withEnableTagOverride​(boolean value)
        Copy the current immutable object by setting a present value for the optional enableTagOverride attribute.
        Parameters:
        value - The value for enableTagOverride
        Returns:
        A modified copy of this object
      • withEnableTagOverride

        public final ImmutableService withEnableTagOverride​(java.util.Optional<java.lang.Boolean> optional)
        Copy the current immutable object by setting an optional value for the enableTagOverride attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for enableTagOverride
        Returns:
        A modified copy of this object
      • withTags

        public final ImmutableService withTags​(java.lang.String... elements)
        Copy the current immutable object with elements that replace the content of tags.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withTags

        public final ImmutableService withTags​(java.lang.Iterable<java.lang.String> elements)
        Copy the current immutable object with elements that replace the content of tags. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of tags elements to set
        Returns:
        A modified copy of this object
      • withAddress

        public final ImmutableService withAddress​(java.lang.String value)
        Copy the current immutable object by setting a value for the address attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for address
        Returns:
        A modified copy of the this object
      • withMeta

        public final ImmutableService withMeta​(java.util.Map<java.lang.String,​? extends java.lang.String> entries)
        Copy the current immutable object by replacing the meta 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 meta map
        Returns:
        A modified copy of this object
      • withPort

        public final ImmutableService withPort​(int value)
        Copy the current immutable object by setting a value for the port attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for port
        Returns:
        A modified copy of the this object
      • withWeights

        public final ImmutableService withWeights​(ServiceWeights value)
        Copy the current immutable object by setting a present value for the optional weights attribute.
        Parameters:
        value - The value for weights
        Returns:
        A modified copy of this object
      • withWeights

        public final ImmutableService withWeights​(java.util.Optional<? extends ServiceWeights> optional)
        Copy the current immutable object by setting an optional value for the weights attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for weights
        Returns:
        A modified copy of this object
      • equals

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

        public int hashCode()
        Computes a hash code from attributes: id, service, enableTagOverride, tags, address, meta, port, weights.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

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

        public static ImmutableService.Builder builder()
        Creates a builder for ImmutableService.
         ImmutableService.builder()
            .id(String) // required id
            .service(String) // required service
            .enableTagOverride(Boolean) // optional enableTagOverride
            .addTags|addAllTags(String) // tags elements
            .address(String) // required address
            .putMeta|putAllMeta(String => String) // meta mappings
            .port(int) // required port
            .weights(com.orbitz.consul.model.catalog.ServiceWeights) // optional weights
            .build();
         
        Returns:
        A new ImmutableService builder