Class ImmutableModule

  • All Implemented Interfaces:
    Module

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

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

    • Method Detail

      • getName

        public String getName()
        Specified by:
        getName in interface Module
        Returns:
        The value of the name attribute
      • getProtos

        public com.google.common.collect.ImmutableList<Proto> getProtos()
        Specified by:
        getProtos in interface Module
        Returns:
        The value of the protos attribute
      • getOutput

        public String getOutput()
        Specified by:
        getOutput in interface Module
        Returns:
        The value of the output attribute
      • getOptions

        public com.google.common.collect.ImmutableMap<String,​Object> getOptions()
        Specified by:
        getOptions in interface Module
        Returns:
        The value of the options attribute
      • usageIndex

        public UsageIndex usageIndex()
        Specified by:
        usageIndex in interface Module
        Returns:
        The value of the usageIndex attribute
      • withName

        public final ImmutableModule withName​(String value)
        Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for name
        Returns:
        A modified copy of the this object
      • withProtos

        public final ImmutableModule withProtos​(Proto... elements)
        Copy the current immutable object with elements that replace the content of protos.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withProtos

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

        public final ImmutableModule withOutput​(String value)
        Copy the current immutable object by setting a value for the output attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for output
        Returns:
        A modified copy of the this object
      • withOptions

        public final ImmutableModule withOptions​(Map<String,​? extends Object> entries)
        Copy the current immutable object by replacing the options 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 options map
        Returns:
        A modified copy of this object
      • withUsageIndex

        public final ImmutableModule withUsageIndex​(UsageIndex value)
        Copy the current immutable object by setting a value for the usageIndex attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for usageIndex
        Returns:
        A modified copy of the this object
      • equals

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

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

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

        public static ImmutableModule.Builder builder()
        Creates a builder for ImmutableModule.
         ImmutableModule.builder()
            .name(String) // required name
            .addProtos|addAllProtos(io.protostuff.compiler.model.Proto) // protos elements
            .output(String) // required output
            .putOptions|putAllOptions(String => Object) // options mappings
            .usageIndex(io.protostuff.compiler.model.UsageIndex) // required usageIndex
            .build();
         
        Returns:
        A new ImmutableModule builder