StringSubstitution (Jakarta-ORO 2.0.8 API)
Date: 2019-09-02

org.apache.oro.text.regex

## Class StringSubstitution

- java.lang.Object
- - org.apache.oro.text.regex.StringSubstitution

- All Implemented Interfaces:
    Substitution
  Direct Known Subclasses:
    Perl5Substitution

      public class StringSubstitution
      extends java.lang.Object
      implements Substitution

  StringSubstitution implements a Substitution consisting of a simple literal string. This class is intended for use with `Util.substitute`.
  Since:
    1.1
  Version:
    2.0.8
  See Also:
    `Substitution`, `Util`, `Util.substitute(org.apache.oro.text.regex.PatternMatcher, org.apache.oro.text.regex.Pattern, org.apache.oro.text.regex.Substitution, java.lang.String, int)`, `Substitution`, `Perl5Substitution`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringSubstitution()` Default constructor initializing substitution to a zero length String.
    `StringSubstitution(java.lang.String substitution)` Creates a StringSubstitution representing the given string.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendSubstitution(java.lang.StringBuffer appendBuffer, MatchResult match, int substitutionCount, PatternMatcherInput originalInput, PatternMatcher matcher, Pattern pattern)` Appends the substitution to a buffer containing the original input with substitutions applied for the pattern matches found so far.
    `java.lang.String` | `getSubstitution()` Returns the string substitution represented by this object.
    `void` | `setSubstitution(java.lang.String substitution)` Sets the substitution represented by this StringSubstitution.
    `java.lang.String` | `toString()` Returns the same value as `getSubstitution()`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### StringSubstitution

          public StringSubstitution()

      Default constructor initializing substitution to a zero length String.

    - #### StringSubstitution

          public StringSubstitution(java.lang.String substitution)

      Creates a StringSubstitution representing the given string.

      Parameters:
        `substitution` - The string to use as a substitution.

  - ### Method Detail

    - #### setSubstitution

          public void setSubstitution(java.lang.String substitution)

      Sets the substitution represented by this StringSubstitution. You should use this method in order to avoid repeatedly allocating new StringSubstitutions. It is recommended that you allocate a single StringSubstitution and reuse it by using this method when appropriate.

      Parameters:
        `substitution` - The string to use as a substitution.

    - #### getSubstitution

          public java.lang.String getSubstitution()

      Returns the string substitution represented by this object.

      Returns:
        The string substitution represented by this object.

    - #### toString

          public java.lang.String toString()

      Returns the same value as `getSubstitution()`.

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        The string substitution represented by this object.

    - #### appendSubstitution

          public void appendSubstitution(java.lang.StringBuffer appendBuffer,
                                         MatchResult match,
                                         int substitutionCount,
                                         PatternMatcherInput originalInput,
                                         PatternMatcher matcher,
                                         Pattern pattern)

      Appends the substitution to a buffer containing the original input with substitutions applied for the pattern matches found so far. See `Substitution.appendSubstition()` for more details regarding the expected behavior of this method.

      Specified by:
        `appendSubstitution` in interface `Substitution`
      Parameters:
        `appendBuffer` - The buffer containing the new string resulting from performing substitutions on the original input.
        `match` - The current match causing a substitution to be made.
        `substitutionCount` - The number of substitutions that have been performed so far by Util.substitute.
        `originalInput` - The original input upon which the substitutions are being performed. This is a read-only parameter and is not modified.
        `matcher` - The PatternMatcher used to find the current match.
        `pattern` - The Pattern used to find the current match.

Copyright ? 2000-2003 Apache Software Foundation. All Rights Reserved.