@@ -30,41 +30,53 @@ public abstract class PropertyNamingStrategies
30
30
* and no separator is used between words. Since this is the native Java naming convention,
31
31
* naming strategy will not do any transformation between names in data (JSON) and
32
32
* POJOS.
33
+ *<p>
34
+ * Example external property names would be "numberValue", "namingStrategy", "theDefiniteProof".
33
35
*/
34
- public static final PropertyNamingStrategy LOWER_CAMEL_CASE = new PropertyNamingStrategy ();
36
+ public static final PropertyNamingStrategy LOWER_CAMEL_CASE = new LowerCamelCaseStrategy ();
35
37
36
38
/**
37
- * Naming convention used in languages like Pascal, where words are capitalized
39
+ * Naming convention used in languages like Pascal, where all words are capitalized
38
40
* and no separator is used between words.
39
41
* See {@link UpperCamelCaseStrategy} for details.
42
+ *<p>
43
+ * Example external property names would be "NumberValue", "NamingStrategy", "TheDefiniteProof".
40
44
*/
41
45
public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy ();
42
46
43
47
/**
44
48
* Naming convention used in languages like C, where words are in lower-case
45
49
* letters, separated by underscores.
46
50
* See {@link SnakeCaseStrategy} for details.
51
+ *<p>
52
+ * Example external property names would be "number_value", "naming_strategy", "the_definite_proof".
47
53
*/
48
54
public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy ();
49
55
50
56
/**
51
57
* Naming convention in which all words of the logical name are in lower case, and
52
58
* no separator is used between words.
53
59
* See {@link LowerCaseStrategy} for details.
60
+ *<p>
61
+ * Example external property names would be "numbervalue", "namingstrategy", "thedefiniteproof".
54
62
*/
55
63
public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy ();
56
64
57
65
/**
58
66
* Naming convention used in languages like Lisp, where words are in lower-case
59
67
* letters, separated by hyphens.
60
68
* See {@link KebabCaseStrategy} for details.
69
+ *<p>
70
+ * Example external property names would be "number-value", "naming-strategy", "the-definite-proof".
61
71
*/
62
72
public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy ();
63
73
64
74
/**
65
75
* Naming convention widely used as configuration properties name, where words are in
66
76
* lower-case letters, separated by dots.
67
77
* See {@link LowerDotCaseStrategy} for details.
78
+ *<p>
79
+ * Example external property names would be "number.value", "naming.strategy", "the.definite.proof".
68
80
*/
69
81
public static final PropertyNamingStrategy LOWER_DOT_CASE = new LowerDotCaseStrategy ();
70
82
@@ -77,7 +89,7 @@ public abstract class PropertyNamingStrategies
77
89
/**
78
90
* Intermediate base class for simple implementations
79
91
*/
80
- static abstract class NamingBase
92
+ public static abstract class NamingBase
81
93
extends PropertyNamingStrategy
82
94
{
83
95
private static final long serialVersionUID = 2L ;
@@ -152,39 +164,39 @@ protected String translateLowerCaseWithSeparator(final String input, final char
152
164
*/
153
165
154
166
/**
155
- * A {@link PropertyNamingStrategy} that translates typical camel case Java
156
- * property names to lower case JSON element names, separated by
157
- * underscores. This implementation is somewhat lenient, in that it
158
- * provides some additional translations beyond strictly translating from
159
- * camel case only. In particular, the following translations are applied
167
+ * A {@link PropertyNamingStrategy} that translates typical camel case Java
168
+ * property names to lower case JSON element names, separated by
169
+ * underscores. This implementation is somewhat lenient, in that it
170
+ * provides some additional translations beyond strictly translating from
171
+ * camel case only. In particular, the following translations are applied
160
172
* by this PropertyNamingStrategy.
161
173
*
162
- * <ul><li>Every upper case letter in the Java property name is translated
163
- * into two characters, an underscore and the lower case equivalent of the
174
+ * <ul><li>Every upper case letter in the Java property name is translated
175
+ * into two characters, an underscore and the lower case equivalent of the
164
176
* target character, with three exceptions.
165
177
* <ol><li>For contiguous sequences of upper case letters, characters after
166
- * the first character are replaced only by their lower case equivalent,
178
+ * the first character are replaced only by their lower case equivalent,
167
179
* and are not preceded by an underscore.
168
- * <ul><li>This provides for reasonable translations of upper case acronyms,
169
- * e.g., "theWWW" is translated to "the_www".</li></ul></li>
170
- * <li>An upper case character in the first position of the Java property
171
- * name is not preceded by an underscore character, and is translated only
180
+ * <ul><li>This provides for reasonable translations of upper case acronyms,
181
+ * e.g., "theWWW" is translated to "the_www".</li></ul></li
182
+ * <li>An upper case character in the first position of the Java property
183
+ * name is not preceded by an underscore character, and is translated only
172
184
* to its lower case equivalent.
173
- * <ul><li>For example, "Results" is translated to "results",
185
+ * <ul><li>For example, "Results" is translated to "results",
174
186
* and not to "_results".</li></ul></li>
175
- * <li>An upper case character in the Java property name that is already
176
- * preceded by an underscore character is translated only to its lower case
187
+ * <li>An upper case character in the Java property name that is already
188
+ * preceded by an underscore character is translated only to its lower case
177
189
* equivalent, and is not preceded by an additional underscore.
178
- * <ul><li>For example, "user_Name" is translated to
179
- * "user_name", and not to "user__name" (with two
190
+ * <ul><li>For example, "user_Name" is translated to
191
+ * "user_name", and not to "user__name" (with two
180
192
* underscore characters).</li></ul></li></ol></li>
181
- * <li>If the Java property name starts with an underscore, then that
182
- * underscore is not included in the translated name, unless the Java
183
- * property name is just one character in length, i.e., it is the
184
- * underscore character. This applies only to the first character of the
193
+ * <li>If the Java property name starts with an underscore, then that
194
+ * underscore is not included in the translated name, unless the Java
195
+ * property name is just one character in length, i.e., it is the
196
+ * underscore character. This applies only to the first character of the
185
197
* Java property name.</li></ul>
186
- *
187
- * These rules result in the following additional example translations from
198
+ *<p>
199
+ * These rules result in the following additional example translations from
188
200
* Java property names to JSON element names.
189
201
* <ul><li>"userName" is translated to "user_name"</li>
190
202
* <li>"UserName" is translated to "user_name"</li>
@@ -239,6 +251,20 @@ public String translate(String input)
239
251
}
240
252
}
241
253
254
+ /**
255
+ * "No-operation" strategy that is equivalent to not specifying any
256
+ * strategy: will simply return suggested standard bean naming as-is.
257
+ */
258
+ public static class LowerCamelCaseStrategy extends NamingBase
259
+ {
260
+ private static final long serialVersionUID = 2L ;
261
+
262
+ @ Override
263
+ public String translate (String input ) {
264
+ return input ;
265
+ }
266
+ }
267
+
242
268
/**
243
269
* A {@link PropertyNamingStrategy} that translates typical camelCase Java
244
270
* property names to PascalCase JSON element names (i.e., with a capital
0 commit comments