Class ImmutableTrees.Template

java.lang.Object
org.immutables.generator.processor.Trees.Template
org.immutables.generator.processor.ImmutableTrees.Template
All Implemented Interfaces:
Trees.Block, Trees.Directive, Trees.InvokableStatement, Trees.TemplatePart, Trees.UnitPart
Enclosing class:
ImmutableTrees

@Immutable public static final class ImmutableTrees.Template extends Trees.Template
Immutable implementation of Trees.Template.

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

  • Field Details

  • Constructor Details

  • Method Details

    • parts

      public com.google.common.collect.ImmutableList<Trees.TemplatePart> parts()
      Returns:
      The value of the parts attribute
    • declaration

      public Trees.InvokableDeclaration declaration()
      Returns:
      The value of the declaration attribute
    • isPublic

      public boolean isPublic()
      Overrides:
      isPublic in class Trees.Template
      Returns:
      The value of the isPublic attribute
    • withParts

      public final ImmutableTrees.Template withParts(Trees.TemplatePart... elements)
      Copy the current immutable object with elements that replace the content of parts.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withParts

      public final ImmutableTrees.Template withParts(Iterable<? extends Trees.TemplatePart> elements)
      Copy the current immutable object with elements that replace the content of parts. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of parts elements to set
      Returns:
      A modified copy of this object
    • withDeclaration

      public final ImmutableTrees.Template withDeclaration(Trees.InvokableDeclaration value)
      Copy the current immutable object by setting a value for the declaration attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for declaration
      Returns:
      A modified copy of the this object
    • withIsPublic

      public final ImmutableTrees.Template withIsPublic(boolean value)
      Copy the current immutable object by setting a value for the isPublic attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isPublic
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of Template 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.Template another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: parts, declaration, isPublic.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableTrees.Template copyOf(Trees.Template instance)
      Creates an immutable copy of a Trees.Template 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 Template instance
    • builder

      public static ImmutableTrees.Template.Builder builder()
      Creates a builder for Template.
       ImmutableTrees.Template.builder()
          .addParts|addAllParts(org.immutables.generator.processor.Trees.TemplatePart) // parts elements
          .declaration(org.immutables.generator.processor.Trees.InvokableDeclaration) // required declaration
          .isPublic(boolean) // optional isPublic
          .build();
       
      Returns:
      A new Template builder