com.fasterxml.jackson.databind.introspect

Class DefaultAccessorNamingStrategy.Provider

    • Method Detail

      • 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

        public DefaultAccessorNamingStrategy.Provider withBaseNameValidator(DefaultAccessorNamingStrategy.BaseNameValidator vld)
        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
      • 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

Copyright © 2008–2023 FasterXML. All rights reserved.