Class StringBuilderOps

java.lang.Object
io.quarkus.gizmo2.creator.ops.ObjectOps
io.quarkus.gizmo2.creator.ops.StringBuilderOps
All Implemented Interfaces:
ComparableOps

public final class StringBuilderOps extends ObjectOps implements ComparableOps
Operations on StringBuilder. The expected usage pattern is:
  1. Create an instance using BlockCreator.withNewStringBuilder()
  2. Append to it using append(Expr)
  3. Create the final string using ObjectOps.toString_()
If you need to perform other operations on the StringBuilder that this class doesn't provide, you should create an instance using BlockCreator.withStringBuilder(Expr), which allows you to pass an already created StringBuilder. This class itself doesn't provide access to the underlying object.
  • Constructor Details

    • StringBuilderOps

      public StringBuilderOps(BlockCreator bc, Expr obj)
      Construct a new instance on an existing StringBuilder.
      Parameters:
      bc - the block creator (must not be null)
      obj - the receiver string builder (must not be null)
    • StringBuilderOps

      public StringBuilderOps(BlockCreator bc)
      Construct a new instance on a newly created StringBuilder.
      Parameters:
      bc - the block creator (must not be null)
    • StringBuilderOps

      public StringBuilderOps(BlockCreator bc, int capacity)
      Construct a new instance on a newly created StringBuilder with given capacity.
      Parameters:
      bc - the block creator (must not be null)
      capacity - the capacity of the newly created StringBuilder
  • Method Details

    • append

      public StringBuilderOps append(Expr expr)
      Appends the string value of given expr to this StringBuilder.
      Parameters:
      expr - the value to append
      Returns:
      this instance
    • append

      public StringBuilderOps append(char constant)
      Appends the given char constant to this StringBuilder.
      Parameters:
      constant - the value to append
      Returns:
      this instance
    • append

      public StringBuilderOps append(String constant)
      Appends the given String constant to this StringBuilder.
      Parameters:
      constant - the value to append
      Returns:
      this instance
    • appendCodePoint

      public StringBuilderOps appendCodePoint(Expr codePoint)
      Appends the given code point to this StringBuilder.
      Parameters:
      codePoint - the value to append (must not be null)
      Returns:
      this instance
    • appendCodePoint

      public StringBuilderOps appendCodePoint(int codePoint)
      Appends the given code point to this StringBuilder.
      Parameters:
      codePoint - the value to append
      Returns:
      this instance
    • setLength

      public void setLength(Expr length)
      Set the length of this StringBuilder.
      Parameters:
      length - the length expression (must not be null)
    • setLength

      public void setLength(int length)
      Set the length of this StringBuilder.
      Parameters:
      length - the constant length
    • compareTo

      public Expr compareTo(Expr other)
      Description copied from interface: ComparableOps
      Generate a call to Comparable.compareTo(Object).
      Specified by:
      compareTo in interface ComparableOps
      Parameters:
      other - the other object to compare (must not be null)
      Returns:
      the expression of the result (not null)