org.codehaus.jackson.map

## Class PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

- java.lang.Object
- - org.codehaus.jackson.map.PropertyNamingStrategy
  - - org.codehaus.jackson.map.PropertyNamingStrategy.PropertyNamingStrategyBase
    - - org.codehaus.jackson.map.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

- Enclosing class:
    PropertyNamingStrategy

      public static class PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy
      extends PropertyNamingStrategy.PropertyNamingStrategyBase

  A `PropertyNamingStrategy` that translates typical camel case Java property names to lower case JSON element names, separated by underscores. This implementation is somewhat lenient, in that it provides some additional translations beyond strictly translating from camel case only. In particular, the following translations are applied by this PropertyNamingStrategy.
  - Every upper case letter in the Java property name is translated into two characters, an underscore and the lower case equivalent of the target character, with three exceptions.
    1. For contiguous sequences of upper case letters, characters after the first character are replaced only by their lower case equivalent, and are not preceded by an underscore.
       - This provides for reasonable translations of upper case acronyms, e.g., "theWWW" is translated to "the_www".
    2. An upper case character in the first position of the Java property name is not preceded by an underscore character, and is translated only to its lower case equivalent.
       - For example, "Results" is translated to "results", and not to "_results".
    3. An upper case character in the Java property name that is already preceded by an underscore character is translated only to its lower case equivalent, and is not preceded by an additional underscore.
       - For example, "user_Name" is translated to "user_name", and not to "user__name" (with two underscore characters).
  - If the Java property name starts with an underscore, then that underscore is not included in the translated name, unless the Java property name is just one character in length, i.e., it is the underscore character. This applies only to the first character of the Java property name.
  These rules result in the following additional example translations from Java property names to JSON element names.
  - "userName" is translated to "user_name"
  - "UserName" is translated to "user_name"
  - "USER_NAME" is translated to "user_name"
  - "user_name" is translated to "user_name" (unchanged)
  - "user" is translated to "user" (unchanged)
  - "User" is translated to "user"
  - "USER" is translated to "user"
  - "_user" is translated to "user"
  - "_User" is translated to "user"
  - "__user" is translated to "_user" (the first of two underscores was removed)
  - "user__name" is translated to "user__name" (unchanged, with two underscores)
  Since:
    1.9

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.codehaus.jackson.map.PropertyNamingStrategy

      `PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy, PropertyNamingStrategy.PropertyNamingStrategyBase`

  - ### Field Summary

    - ### Fields inherited from class org.codehaus.jackson.map.PropertyNamingStrategy

      `CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `translate(String input)`

    - ### Methods inherited from class org.codehaus.jackson.map.PropertyNamingStrategy.PropertyNamingStrategyBase

      `nameForConstructorParameter, nameForField, nameForGetterMethod, nameForSetterMethod`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

          public PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy()

  - ### Method Detail

    - #### translate

          public String translate(String input)

      Specified by:
        `translate` in class `PropertyNamingStrategy.PropertyNamingStrategyBase`