Class SnakeToCamelCaseRule

java.lang.Object
com.streamconverter.command.rule.impl.casing.SnakeToCamelCaseRule
All Implemented Interfaces:
IRule

public class SnakeToCamelCaseRule extends Object implements IRule
Transforms snake_case strings to camelCase format.

This rule converts strings from snake_case notation to camelCase notation by removing underscores and capitalizing the first letter of each word after the first.

Examples:

  • user_nameuserName
  • first_namefirstName
  • user_account_iduserAccountId
  • xml_http_requestxmlHttpRequest

Usage:


 IRule rule = SnakeToCamelCaseRule.builder().build();
 IStreamCommand command = JsonNavigateCommand.create("$.user_name", rule);
 
Since:
1.0
  • Method Details

    • apply

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

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

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

      Creates a builder for configuring the SnakeToCamelCaseRule.
      Returns:
      new builder instance
    • create

      public static SnakeToCamelCaseRule create()
      Creates a SnakeToCamelCaseRule with default settings (camelCase, not PascalCase).
      Returns:
      new rule instance with default configuration
    • createPascalCase

      Creates a SnakeToCamelCaseRule that produces PascalCase output.
      Returns:
      new rule instance configured for PascalCase
    • toString

      public String toString()
      Overrides:
      toString in class Object