Package io.protostuff.compiler
Enum Formatter.BUILTIN
- All Implemented Interfaces:
Formatter
,Serializable
,Comparable<Formatter.BUILTIN>
,java.lang.constant.Constable
- Enclosing interface:
Formatter
Built-in formatters.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface io.protostuff.compiler.Formatter
Formatter.BUILTIN
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptioncamel-case.camel-case with trailing underscore.lowercase.pascal-case.pascal-case with space in between.Transform word in singular form to plural form.Same as PCS but with the more correct name :/.Transform word in plural form to singular form.underscore-case.underscore-case with trailing underscore.uppercase."uppercased" underscore-case. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Add all the builtin formatters to the map using the enum's name as key.private static void
addIrregular
(String rule, String replacement) private static void
private static void
addSingular
(String rule, String replacement) private static String
Replaces a found pattern in a word and returns a transformed word.private static String
private static String
singularize
(String word) static Formatter.BUILTIN
Returns the enum constant of this type with the specified name.static Formatter.BUILTIN[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
UPPER
uppercase. -
LOWER
lowercase. -
CC
camel-case.some_foo/SomeFoo becomes someFoo
-
CCU
camel-case with trailing underscore.some_foo/SomeFoo/someFoo becomes someFoo_
-
UC
underscore-case.someFoo/SomeFoo becomes some_foo
-
UCU
underscore-case with trailing underscore.someFoo/SomeFoo/some_foo becomes some_foo_
-
UUC
"uppercased" underscore-case.someFoo/SomeFoo/some_foo becomes SOME_FOO
-
PC
pascal-case.some_foo/someFoo becomes SomeFoo
-
PCS
pascal-case with space in between.someFoo/some_foo/SomeFoo becomes "Some Foo"
-
PSC
Same as PCS but with the more correct name :/.The space "S" is really in-between.
-
PLURAL
Transform word in singular form to plural form. If given word is already in the plural form, it should not be changed. Please not that this formatter does not guarantee that all words can be transformed correctly. The implementation was cloned from https://github.com/javalite/activejdbc/blob/master/javalite-common/src/main /java/org/javalite/common/Inflector.java Copyright 2009-2014 Igor Polevoy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -
SINGULAR
Transform word in plural form to singular form. If given word is already in the singular form, it should not be changed. Please not that this formatter does not guarantee that all words can be transformed correctly. The implementation was cloned from https://github.com/javalite/activejdbc/blob/master/javalite-common/src/main /java/org/javalite/common/Inflector.java Copyright 2009-2014 Igor Polevoy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -
TRIM
-
CUT_L
-
CUT_R
-
-
Field Details
-
singulars
-
plurals
-
irregulars
-
uncountables
-
-
Constructor Details
-
BUILTIN
private BUILTIN()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
addPlural
-
addSingular
-
addIrregular
-
gsub
Replaces a found pattern in a word and returns a transformed word. Null is pattern does not match. -
pluralize
-
singularize
-
addAllTo
Add all the builtin formatters to the map using the enum's name as key.
-