Class LowerCaseRule

java.lang.Object
com.streamconverter.command.rule.impl.string.LowerCaseRule
All Implemented Interfaces:
IRule

public class LowerCaseRule extends Object implements IRule
Converts strings to lowercase.

This rule converts all uppercase letters in the input string to lowercase using the specified locale or the default locale if none is specified.

Examples:

  • "HELLO""hello"
  • "Hello World""hello world"
  • "XMLHttpRequest""xmlhttprequest"

Usage:


 IRule rule = new LowerCaseRule();
 IRule localeRule = new LowerCaseRule(Locale.ENGLISH);
 IStreamCommand command = JsonNavigateCommand.create("$.name", rule);
 
Since:
1.0
  • Constructor Details

    • LowerCaseRule

      public LowerCaseRule()
      Creates a LowerCaseRule using the default locale.
    • LowerCaseRule

      public LowerCaseRule(Locale locale)
      Creates a LowerCaseRule using the specified locale.
      Parameters:
      locale - the locale to use for case conversion
      Throws:
      IllegalArgumentException - if locale is null
  • Method Details

    • apply

      public String apply(String input)
      Description copied from interface: IRule
      ルールの適用を実行します。

      このメソッドは、ストリーム変換の際にルールを適用するために使用されます。 具体的なルールの実装は、このメソッドをオーバーライドして定義します。 変換対象とする箇所を特定したあとにこのメソッドを呼び出すことを想定しています。

      Specified by:
      apply in interface IRule
      Parameters:
      input - 変換対象の文字列
      Returns:
      String output 変換結果を格納する文字列
    • getLocale

      public Locale getLocale()
      Gets the locale used for case conversion.
      Returns:
      the locale
    • toString

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object