Class ImmutableCustomTypeMeta

java.lang.Object
org.nuiton.db.meta.ImmutableCustomTypeMeta
All Implemented Interfaces:
CustomTypeMeta

@Generated(from="CustomTypeMeta", generator="Immutables") @ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableCustomTypeMeta extends Object implements CustomTypeMeta
Immutable implementation of CustomTypeMeta.

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

  • Method Details

    • getName

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

      public Optional<String> getComment()
      Specified by:
      getComment in interface CustomTypeMeta
      Returns:
      The value of the comment attribute
    • getEnumEquivalence

      public Optional<Class<? extends Enum>> getEnumEquivalence()
      Specified by:
      getEnumEquivalence in interface CustomTypeMeta
      Returns:
      The value of the enumEquivalence attribute
    • getValues

      public com.google.common.collect.ImmutableList<String> getValues()
      Specified by:
      getValues in interface CustomTypeMeta
      Returns:
      The value of the values attribute
    • withName

      public final ImmutableCustomTypeMeta 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 or the this object
    • withComment

      public final ImmutableCustomTypeMeta withComment(String value)
      Copy the current immutable object by setting a present value for the optional comment attribute.
      Parameters:
      value - The value for comment
      Returns:
      A modified copy or this if not changed
    • withComment

      public final ImmutableCustomTypeMeta withComment(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the comment attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for comment
      Returns:
      A modified copy or this if not changed
    • withEnumEquivalence

      public final ImmutableCustomTypeMeta withEnumEquivalence(Class<? extends Enum> value)
      Copy the current immutable object by setting a present value for the optional enumEquivalence attribute.
      Parameters:
      value - The value for enumEquivalence
      Returns:
      A modified copy or this if not changed
    • withEnumEquivalence

      public final ImmutableCustomTypeMeta withEnumEquivalence(Optional<? extends Class<? extends Enum>> optional)
      Copy the current immutable object by setting an optional value for the enumEquivalence attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for enumEquivalence
      Returns:
      A modified copy or this if not changed
    • withValues

      public final ImmutableCustomTypeMeta withValues(String... elements)
      Copy the current immutable object with elements that replace the content of values.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withValues

      public final ImmutableCustomTypeMeta withValues(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of values elements to set
      Returns:
      A modified copy or this if not changed
    • equals

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

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

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

      public static ImmutableCustomTypeMeta.Builder builder()
      Creates a builder for ImmutableCustomTypeMeta.
      ImmutableCustomTypeMeta.builder()
         .name(String) // required name
         .comment(Optional<String>) // optional comment
         .enumEquivalence(Optional<Class<? extends Enum>>) // optional enumEquivalence
         .addValues|addAllValues(String) // values elements
         .build();
      
      Returns:
      A new ImmutableCustomTypeMeta builder