Class ImmutableTrees.TextLine

java.lang.Object
org.immutables.generator.processor.Trees.TextLine
org.immutables.generator.processor.ImmutableTrees.TextLine
All Implemented Interfaces:
Trees.Synthetic, Trees.TemplatePart
Enclosing class:
ImmutableTrees

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

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

  • Field Details

    • fragment

      private final Trees.TextFragment fragment
    • newline

      private final boolean newline
  • Constructor Details

  • Method Details

    • fragment

      public Trees.TextFragment fragment()
      Specified by:
      fragment in class Trees.TextLine
      Returns:
      The value of the fragment attribute
    • newline

      public boolean newline()
      Overrides:
      newline in class Trees.TextLine
      Returns:
      The value of the newline attribute
    • withFragment

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

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

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

      public int hashCode()
      Computes a hash code from attributes: fragment, newline.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • copyOf

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

      public static ImmutableTrees.TextLine.Builder builder()
      Creates a builder for TextLine.
       ImmutableTrees.TextLine.builder()
          .fragment(org.immutables.generator.processor.Trees.TextFragment) // required fragment
          .newline(boolean) // optional newline
          .build();
       
      Returns:
      A new TextLine builder