@@ -33,7 +33,7 @@ public abstract class PropertyNamingStrategies
33
33
*<p>
34
34
* Example external property names would be "numberValue", "namingStrategy", "theDefiniteProof".
35
35
*/
36
- public static final PropertyNamingStrategy LOWER_CAMEL_CASE = new LowerCamelCaseStrategy () ;
36
+ public static final PropertyNamingStrategy LOWER_CAMEL_CASE = LowerCamelCaseStrategy . INSTANCE ;
37
37
38
38
/**
39
39
* Naming convention used in languages like Pascal, where all words are capitalized
@@ -42,7 +42,7 @@ public abstract class PropertyNamingStrategies
42
42
*<p>
43
43
* Example external property names would be "NumberValue", "NamingStrategy", "TheDefiniteProof".
44
44
*/
45
- public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy () ;
45
+ public static final PropertyNamingStrategy UPPER_CAMEL_CASE = UpperCamelCaseStrategy . INSTANCE ;
46
46
47
47
/**
48
48
* Naming convention used in languages like C, where words are in lower-case
@@ -51,15 +51,15 @@ public abstract class PropertyNamingStrategies
51
51
*<p>
52
52
* Example external property names would be "number_value", "naming_strategy", "the_definite_proof".
53
53
*/
54
- public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy () ;
54
+ public static final PropertyNamingStrategy SNAKE_CASE = SnakeCaseStrategy . INSTANCE ;
55
55
56
56
/**
57
57
* Naming convention in which the words are in upper-case letters, separated by underscores.
58
58
* See {@link UpperSnakeCaseStrategy} for details.
59
59
* @since 2.13
60
60
* <p>
61
61
*/
62
- public static final PropertyNamingStrategy UPPER_SNAKE_CASE = new UpperSnakeCaseStrategy () ;
62
+ public static final PropertyNamingStrategy UPPER_SNAKE_CASE = UpperSnakeCaseStrategy . INSTANCE ;
63
63
64
64
/**
65
65
* Naming convention in which all words of the logical name are in lower case, and
@@ -68,7 +68,7 @@ public abstract class PropertyNamingStrategies
68
68
*<p>
69
69
* Example external property names would be "numbervalue", "namingstrategy", "thedefiniteproof".
70
70
*/
71
- public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy () ;
71
+ public static final PropertyNamingStrategy LOWER_CASE = LowerCaseStrategy . INSTANCE ;
72
72
73
73
/**
74
74
* Naming convention used in languages like Lisp, where words are in lower-case
@@ -77,7 +77,7 @@ public abstract class PropertyNamingStrategies
77
77
*<p>
78
78
* Example external property names would be "number-value", "naming-strategy", "the-definite-proof".
79
79
*/
80
- public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy () ;
80
+ public static final PropertyNamingStrategy KEBAB_CASE = KebabCaseStrategy . INSTANCE ;
81
81
82
82
/**
83
83
* Naming convention widely used as configuration properties name, where words are in
@@ -86,7 +86,7 @@ public abstract class PropertyNamingStrategies
86
86
*<p>
87
87
* Example external property names would be "number.value", "naming.strategy", "the.definite.proof".
88
88
*/
89
- public static final PropertyNamingStrategy LOWER_DOT_CASE = new LowerDotCaseStrategy () ;
89
+ public static final PropertyNamingStrategy LOWER_DOT_CASE = LowerDotCaseStrategy . INSTANCE ;
90
90
91
91
/*
92
92
/**********************************************************************
@@ -224,6 +224,12 @@ public static class SnakeCaseStrategy extends NamingBase
224
224
{
225
225
private static final long serialVersionUID = 2L ;
226
226
227
+ /**
228
+ * @since 2.14
229
+ */
230
+ public final static PropertyNamingStrategies .SnakeCaseStrategy INSTANCE
231
+ = new PropertyNamingStrategies .SnakeCaseStrategy ();
232
+
227
233
@ Override
228
234
public String translate (String input )
229
235
{
@@ -270,6 +276,12 @@ public static class UpperSnakeCaseStrategy extends SnakeCaseStrategy
270
276
{
271
277
private static final long serialVersionUID = 2L ;
272
278
279
+ /**
280
+ * @since 2.14
281
+ */
282
+ public final static PropertyNamingStrategies .UpperSnakeCaseStrategy INSTANCE
283
+ = new PropertyNamingStrategies .UpperSnakeCaseStrategy ();
284
+
273
285
@ Override
274
286
public String translate (String input ) {
275
287
String output = super .translate (input );
@@ -287,6 +299,12 @@ public static class LowerCamelCaseStrategy extends NamingBase
287
299
{
288
300
private static final long serialVersionUID = 2L ;
289
301
302
+ /**
303
+ * @since 2.14
304
+ */
305
+ public final static PropertyNamingStrategies .LowerCamelCaseStrategy INSTANCE
306
+ = new PropertyNamingStrategies .LowerCamelCaseStrategy ();
307
+
290
308
@ Override
291
309
public String translate (String input ) {
292
310
return input ;
@@ -310,6 +328,12 @@ public static class UpperCamelCaseStrategy extends NamingBase
310
328
{
311
329
private static final long serialVersionUID = 2L ;
312
330
331
+ /**
332
+ * @since 2.14
333
+ */
334
+ public final static PropertyNamingStrategies .UpperCamelCaseStrategy INSTANCE
335
+ = new PropertyNamingStrategies .UpperCamelCaseStrategy ();
336
+
313
337
/**
314
338
* Converts camelCase to PascalCase
315
339
*
@@ -346,6 +370,12 @@ public static class LowerCaseStrategy extends NamingBase
346
370
{
347
371
private static final long serialVersionUID = 2L ;
348
372
373
+ /**
374
+ * @since 2.14
375
+ */
376
+ public final static PropertyNamingStrategies .LowerCaseStrategy INSTANCE
377
+ = new PropertyNamingStrategies .LowerCaseStrategy ();
378
+
349
379
@ Override
350
380
public String translate (String input ) {
351
381
return input .toLowerCase ();
@@ -362,6 +392,12 @@ public static class KebabCaseStrategy extends NamingBase
362
392
{
363
393
private static final long serialVersionUID = 2L ;
364
394
395
+ /**
396
+ * @since 2.14
397
+ */
398
+ public final static PropertyNamingStrategies .KebabCaseStrategy INSTANCE
399
+ = new PropertyNamingStrategies .KebabCaseStrategy ();
400
+
365
401
@ Override
366
402
public String translate (String input ) {
367
403
return translateLowerCaseWithSeparator (input , '-' );
@@ -373,12 +409,20 @@ public String translate(String input) {
373
409
* but instead of hyphens
374
410
* as separators, uses dots. Naming convention widely used as configuration properties name.
375
411
*/
376
- public static class LowerDotCaseStrategy extends NamingBase {
412
+ public static class LowerDotCaseStrategy extends NamingBase
413
+ {
377
414
private static final long serialVersionUID = 2L ;
378
415
416
+ /**
417
+ * @since 2.14
418
+ */
419
+ public final static PropertyNamingStrategies .LowerDotCaseStrategy INSTANCE
420
+ = new PropertyNamingStrategies .LowerDotCaseStrategy ();
421
+
379
422
@ Override
380
423
public String translate (String input ){
381
424
return translateLowerCaseWithSeparator (input , '.' );
382
425
}
383
426
}
384
427
}
428
+
0 commit comments