Enum Class Formatter.BUILTIN

java.lang.Object
java.lang.Enum<Formatter.BUILTIN>
io.protostuff.compiler.Formatter.BUILTIN
All Implemented Interfaces:
Formatter, Serializable, Comparable<Formatter.BUILTIN>, Constable
Enclosing interface:
Formatter

public static enum Formatter.BUILTIN extends Enum<Formatter.BUILTIN> implements Formatter
Built-in formatters.
  • Enum Constant Details

    • UPPER

      public static final Formatter.BUILTIN UPPER
      uppercase.
    • LOWER

      public static final Formatter.BUILTIN LOWER
      lowercase.
    • CC

      public static final Formatter.BUILTIN CC
      camel-case.

       some_foo/SomeFoo becomes someFoo
       
    • CCU

      public static final Formatter.BUILTIN CCU
      camel-case with trailing underscore.

       some_foo/SomeFoo/someFoo becomes someFoo_
       
    • UC

      public static final Formatter.BUILTIN UC
      underscore-case.

       someFoo/SomeFoo becomes some_foo
       
    • UCU

      public static final Formatter.BUILTIN UCU
      underscore-case with trailing underscore.

       someFoo/SomeFoo/some_foo becomes some_foo_
       
    • UUC

      public static final Formatter.BUILTIN UUC
      "uppercased" underscore-case.

       someFoo/SomeFoo/some_foo becomes SOME_FOO
       
    • PC

      public static final Formatter.BUILTIN PC
      pascal-case.

       some_foo/someFoo becomes SomeFoo
       
    • PCS

      public static final Formatter.BUILTIN PCS
      pascal-case with space in between.

       someFoo/some_foo/SomeFoo becomes "Some Foo"
       
    • PSC

      public static final Formatter.BUILTIN PSC
      Same as PCS but with the more correct name :/.

      The space "S" is really in-between.

    • PLURAL

      public static final Formatter.BUILTIN 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

      public static final Formatter.BUILTIN 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

      public static final Formatter.BUILTIN TRIM
    • CUT_L

      public static final Formatter.BUILTIN CUT_L
    • CUT_R

      public static final Formatter.BUILTIN CUT_R
  • Field Details

    • singulars

      private static List<String[]> singulars
    • plurals

      private static List<String[]> plurals
    • irregulars

      private static List<String[]> irregulars
    • uncountables

      private static List<String> uncountables
  • Constructor Details

    • BUILTIN

      private BUILTIN()
  • Method Details

    • values

      public static Formatter.BUILTIN[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Formatter.BUILTIN valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • addPlural

      private static void addPlural(String rule, String replacement)
    • addSingular

      private static void addSingular(String rule, String replacement)
    • addIrregular

      private static void addIrregular(String rule, String replacement)
    • gsub

      private static String gsub(String word, String rule, String replacement)
      Replaces a found pattern in a word and returns a transformed word. Null is pattern does not match.
    • pluralize

      private static String pluralize(String word)
    • singularize

      private static String singularize(String word)
    • addAllTo

      public static void addAllTo(Map<String,Formatter> map)
      Add all the builtin formatters to the map using the enum's name as key.