Class DefaultAccessorNamingStrategy.Provider

java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.Provider
All Implemented Interfaces:
Serializable
Enclosing class:
DefaultAccessorNamingStrategy

public static class DefaultAccessorNamingStrategy.Provider extends AccessorNamingStrategy.Provider implements Serializable
Provider for DefaultAccessorNamingStrategy.

Default instance will use following default prefixes:

  • Setter for regular POJOs: "set"
  • Builder-mutator: "with"
  • Regular getter: "get"
  • Is-getter (for Boolean values): "is"
and no additional restrictions on base names accepted (configurable for limits using DefaultAccessorNamingStrategy.BaseNameValidator), allowing names like "get_value()" and "getvalue()".
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • withSetterPrefix

      public DefaultAccessorNamingStrategy.Provider withSetterPrefix(String prefix)
      Mutant factory for changing the prefix used for "setter" methods
      Parameters:
      prefix - Prefix to use; or empty String "" to not use any prefix (meaning signature-compatible method name is used as the property basename (and subject to name mangling)), or null to prevent name-based detection.
      Returns:
      Provider instance with specified setter-prefix
    • withBuilderPrefix

      public DefaultAccessorNamingStrategy.Provider withBuilderPrefix(String prefix)
      Mutant factory for changing the prefix used for Builders (from default JsonPOJOBuilder.DEFAULT_WITH_PREFIX)
      Parameters:
      prefix - Prefix to use; or empty String "" to not use any prefix (meaning signature-compatible method name is used as the property basename (and subject to name mangling)), or null to prevent name-based detection.
      Returns:
      Provider instance with specified with-prefix
    • withGetterPrefix

      public DefaultAccessorNamingStrategy.Provider withGetterPrefix(String prefix)
      Mutant factory for changing the prefix used for "getter" methods
      Parameters:
      prefix - Prefix to use; or empty String "" to not use any prefix (meaning signature-compatible method name is used as the property basename (and subject to name mangling)), or null to prevent name-based detection.
      Returns:
      Provider instance with specified getter-prefix
    • withIsGetterPrefix

      public DefaultAccessorNamingStrategy.Provider withIsGetterPrefix(String prefix)
      Mutant factory for changing the prefix used for "is-getter" methods (getters that return boolean/Boolean value).
      Parameters:
      prefix - Prefix to use; or empty String "" to not use any prefix (meaning signature-compatible method name is used as the property basename (and subject to name mangling)). or null to prevent name-based detection.
      Returns:
      Provider instance with specified is-getter-prefix
    • withFirstCharAcceptance

      public DefaultAccessorNamingStrategy.Provider withFirstCharAcceptance(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)
      Mutant factory for changing the rules regarding which characters are allowed as the first character of property base name, after checking and removing prefix.

      For example, consider "getter" method candidate (no arguments, has return type) named getValue() is considered, with "getter-prefix" defined as get, then base name is Value and the first character to consider is V. Upper-case letters are always accepted so this is fine. But with similar settings, method get_value() would only be recognized as getter if allowNonLetterFirstChar is set to true: otherwise it will not be considered a getter-method. Similarly "is-getter" candidate method with name island() would only be considered if allowLowerCaseFirstChar is set to true.

      Parameters:
      allowLowerCaseFirstChar - Whether base names that start with lower-case letter (like "a" or "b") are accepted as valid or not: consider difference between "setter-methods" setValue() and setvalue().
      allowNonLetterFirstChar - Whether base names that start with non-letter character (like "_" or number 1) are accepted as valid or not: consider difference between "setter-methods" setValue() and set_value().
      Returns:
      Provider instance with specified validity rules
    • withBaseNameValidator

      Mutant factory for specifying validator that is used to further verify that base name derived from accessor name is acceptable: this can be used to add further restrictions such as limit that the first character of the base name is an upper-case letter.
      Parameters:
      vld - Validator to use, if any; null to indicate no additional rules
      Returns:
      Provider instance with specified base name validator to use, if any
    • forPOJO

      public AccessorNamingStrategy forPOJO(MapperConfig<?> config, AnnotatedClass targetClass)
      Description copied from class: AccessorNamingStrategy.Provider
      Factory method for creating strategy instance for a "regular" POJO, called if none of the other factory methods is applicable.
      Specified by:
      forPOJO in class AccessorNamingStrategy.Provider
      Parameters:
      config - Current mapper configuration
      targetClass - Information about value type
      Returns:
      Naming strategy instance to use
    • forBuilder

      public AccessorNamingStrategy forBuilder(MapperConfig<?> config, AnnotatedClass builderClass, BeanDescription valueTypeDesc)
      Description copied from class: AccessorNamingStrategy.Provider
      Factory method for creating strategy instance for POJOs that are deserialized using Builder type: in this case eventual target (value) type is different from type of "builder" object that is used by databinding to accumulate state.
      Specified by:
      forBuilder in class AccessorNamingStrategy.Provider
      Parameters:
      config - Current mapper configuration
      builderClass - Information about builder type
      valueTypeDesc - Information about the eventual target (value) type
      Returns:
      Naming strategy instance to use
    • forRecord

      public AccessorNamingStrategy forRecord(MapperConfig<?> config, AnnotatedClass recordClass)
      Description copied from class: AccessorNamingStrategy.Provider
      Factory method for creating strategy instance for special java.lang.Record type (new in JDK 14).
      Specified by:
      forRecord in class AccessorNamingStrategy.Provider
      Parameters:
      config - Current mapper configuration
      recordClass - Information about value type (of type java.lang.Record)
      Returns:
      Naming strategy instance to use