Class CasedString

java.lang.Object
org.apache.rat.utils.CasedString

public final class CasedString extends Object
Handles converting from one string case to another (e.g. camel case to snake case).
Since:
0.17
  • Constructor Details

    • CasedString

      public CasedString(CasedString.StringCase stringCase, String string)
      Creates a cased string by parsing the string argument for the specific case.
      Parameters:
      stringCase - the case of the string being parsed.
      string - the string to parse.
    • CasedString

      public CasedString(CasedString.StringCase stringCase, String[] segments)
      Creates a cased string of the specified case and segments
      Parameters:
      stringCase - the case of the string.
      segments - the segments of the string.
  • Method Details

    • as

      public CasedString as(CasedString.StringCase stringCase)
      Converts this cased string into another format.
      Parameters:
      stringCase - the desired format.
      Returns:
      the new CasedString.
    • getSegments

      public String[] getSegments()
      Gets the segments of this cased string.
      Returns:
      the segments of this cased string.
    • toCase

      public String toCase(CasedString.StringCase stringCase)
      Generates a string from this cased string but with the desired case.
      Parameters:
      stringCase - the desired case.
      Returns:
      this cased string in the desired case.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object