Class ParentheticalStringBuilder

All Implemented Interfaces:
AutoCloseable

public class ParentheticalStringBuilder extends PrependingStringBuilder implements AutoCloseable
IndentingStringBuilder that can be used to wrap appended material with an opening and closing String, but only if any material is written. The opening and closing Strings won't be written unless something else is written to this builder. Note that the closing String also won't be written if this builder is not close()d.
  • Constructor Details

    • ParentheticalStringBuilder

      public ParentheticalStringBuilder(IndentingStringBuilder sb, String openString, String closeString)
      Constructor.
      Parameters:
      sb - the IndentingStringBuilder to write to
      openString - the opening string
      closeString - the closing string
    • ParentheticalStringBuilder

      public ParentheticalStringBuilder(IndentingStringBuilder sb)
      Constructor. This constructor provides "(" and ")" as the opening and closing Strings.
      Parameters:
      sb - the IndentingStringBuilder to write to
  • Method Details