Class CamelToSnakeCaseRule
java.lang.Object
com.streamconverter.command.rule.impl.casing.CamelToSnakeCaseRule
- All Implemented Interfaces:
IRule
Transforms camelCase strings to snake_case format.
This rule converts strings from camelCase notation to snake_case notation by inserting underscores before uppercase letters and converting all letters to lowercase.
Examples:
userName
→user_name
firstName
→first_name
userAccountID
→user_account_id
XMLHttpRequest
→xml_http_request
Usage:
IRule rule = CamelToSnakeCaseRule.builder().build();
IStreamCommand command = JsonNavigateCommand.create("$.userName", rule);
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for CamelToSnakeCaseRule configuration. -
Method Summary
Modifier and TypeMethodDescriptionルールの適用を実行します。static CamelToSnakeCaseRule.Builder
builder()
Creates a builder for configuring the CamelToSnakeCaseRule.static CamelToSnakeCaseRule
create()
Creates a CamelToSnakeCaseRule with default settings.toString()
-
Method Details
-
apply
Description copied from interface:IRule
ルールの適用を実行します。このメソッドは、ストリーム変換の際にルールを適用するために使用されます。 具体的なルールの実装は、このメソッドをオーバーライドして定義します。 変換対象とする箇所を特定したあとにこのメソッドを呼び出すことを想定しています。
-
builder
Creates a builder for configuring the CamelToSnakeCaseRule.- Returns:
- new builder instance
-
create
Creates a CamelToSnakeCaseRule with default settings.- Returns:
- new rule instance with default configuration
-
toString
-