Class ImmutableTrees.ValueDeclaration

java.lang.Object
org.immutables.generator.processor.ImmutableTrees.ValueDeclaration
All Implemented Interfaces:
Trees.Named, Trees.ValueDeclaration
Enclosing class:
ImmutableTrees

@Immutable public static final class ImmutableTrees.ValueDeclaration extends Object implements Trees.ValueDeclaration
Immutable implementation of Trees.ValueDeclaration.

Use the builder to create immutable instances: ImmutableTrees.ValueDeclaration.builder().

  • Field Details

  • Constructor Details

  • Method Details

    • name

      public Trees.Identifier name()
      Specified by:
      name in interface Trees.Named
      Returns:
      The value of the name attribute
    • type

      public com.google.common.base.Optional<Trees.TypeReference> type()
      Specified by:
      type in interface Trees.ValueDeclaration
      Returns:
      The value of the type attribute
    • containedType

      public com.google.common.base.Optional<Trees.TypeReference> containedType()
      Specified by:
      containedType in interface Trees.ValueDeclaration
      Returns:
      The value of the containedType attribute
    • withName

      public final ImmutableTrees.ValueDeclaration withName(Trees.Identifier value)
      Copy the current immutable object by setting a value for the name attribute. A shallow reference equality check is 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
    • withType

      Copy the current immutable object by setting a present value for the optional type attribute.
      Specified by:
      withType in interface Trees.ValueDeclaration
      Parameters:
      value - The value for type
      Returns:
      A modified copy of this object
    • withType

      public final ImmutableTrees.ValueDeclaration withType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)
      Copy the current immutable object by setting an optional value for the type attribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for type
      Returns:
      A modified copy of this object
    • withContainedType

      public final ImmutableTrees.ValueDeclaration withContainedType(Trees.TypeReference value)
      Copy the current immutable object by setting a present value for the optional containedType attribute.
      Specified by:
      withContainedType in interface Trees.ValueDeclaration
      Parameters:
      value - The value for containedType
      Returns:
      A modified copy of this object
    • withContainedType

      public final ImmutableTrees.ValueDeclaration withContainedType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)
      Copy the current immutable object by setting an optional value for the containedType attribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for containedType
      Returns:
      A modified copy of this object
    • equals

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

      private boolean equalTo(int synthetic, ImmutableTrees.ValueDeclaration another)
    • hashCode

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

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

      Creates an immutable copy of a Trees.ValueDeclaration 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 ValueDeclaration instance
    • builder

      public static ImmutableTrees.ValueDeclaration.Builder builder()
      Creates a builder for ValueDeclaration.
       ImmutableTrees.ValueDeclaration.builder()
          .name(org.immutables.generator.processor.Trees.Identifier) // required name
          .type(org.immutables.generator.processor.Trees.TypeReference) // optional type
          .containedType(org.immutables.generator.processor.Trees.TypeReference) // optional containedType
          .build();
       
      Returns:
      A new ValueDeclaration builder