com.fasterxml.jackson.databind.util

## Class EnumResolver

- java.lang.Object
- - com.fasterxml.jackson.databind.util.EnumResolver

- All Implemented Interfaces:
    java.io.Serializable

      public class EnumResolver
      extends java.lang.Object
      implements java.io.Serializable

  Helper class used to resolve String values (either JSON Object field names or regular String values) into Java Enum instances.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Enum<?>` | `_defaultValue`
    `protected java.lang.Class<java.lang.Enum<?>>` | `_enumClass`
    `protected java.lang.Enum<?>[]` | `_enums`
    `protected java.util.HashMap<java.lang.String,java.lang.Enum<?>>` | `_enumsById`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EnumResolver(java.lang.Class<java.lang.Enum<?>> enumClass, java.lang.Enum<?>[] enums, java.util.HashMap<java.lang.String,java.lang.Enum<?>> map, java.lang.Enum<?> defaultValue)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static EnumResolver` | `constructFor(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)` Factory method for constructing resolver that maps from Enum.name() into Enum value
    `CompactStringObjectMap` | `constructLookup()`
    `static EnumResolver` | `constructUnsafe(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)` This method is needed because of the dynamic nature of constructing Enum resolvers.
    `static EnumResolver` | `constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls, java.lang.reflect.Method accessor)` Deprecated. Since 2.8, use `constructUnsafeUsingMethod(Class, Method, AnnotationIntrospector)` instead.
    `static EnumResolver` | `constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls, java.lang.reflect.Method accessor, AnnotationIntrospector ai)` Method used when actual String serialization is indicated using @JsonValue on a method.
    `static EnumResolver` | `constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls)` Deprecated. Since 2.8, use `constructUnsafeUsingToString(Class, AnnotationIntrospector)` instead
    `static EnumResolver` | `constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)` Method that needs to be used instead of `constructUsingToString(java.lang.Class<java.lang.Enum<?>>)` if static type of enum is not known.
    `static EnumResolver` | `constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls, java.lang.reflect.Method accessor)` Deprecated. Since 2.8, use `constructUsingMethod(Class, Method, AnnotationIntrospector)` instead
    `static EnumResolver` | `constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls, java.lang.reflect.Method accessor, AnnotationIntrospector ai)`
    `static EnumResolver` | `constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls)` Deprecated. Since 2.8, use `constructUsingToString(Class, AnnotationIntrospector)` instead
    `static EnumResolver` | `constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)` Factory method for constructing resolver that maps from Enum.toString() into Enum value
    `java.lang.Enum<?>` | `findEnum(java.lang.String key)`
    `java.lang.Enum<?>` | `getDefaultValue()`
    `java.lang.Enum<?>` | `getEnum(int index)`
    `java.lang.Class<java.lang.Enum<?>>` | `getEnumClass()`
    `java.util.Collection<java.lang.String>` | `getEnumIds()`
    `java.util.List<java.lang.Enum<?>>` | `getEnums()`
    `java.lang.Enum<?>[]` | `getRawEnums()`
    `int` | `lastValidIndex()`

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

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

- - ### Field Detail

    - #### _enumClass

          protected final java.lang.Class<java.lang.Enum<?>> _enumClass

    - #### _enums

          protected final java.lang.Enum<?>[] _enums

    - #### _enumsById

          protected final java.util.HashMap<java.lang.String,java.lang.Enum<?>> _enumsById

    - #### _defaultValue

          protected final java.lang.Enum<?> _defaultValue

  - ### Constructor Detail

    - #### EnumResolver

          protected EnumResolver(java.lang.Class<java.lang.Enum<?>> enumClass,
                      java.lang.Enum<?>[] enums,
                      java.util.HashMap<java.lang.String,java.lang.Enum<?>> map,
                      java.lang.Enum<?> defaultValue)

  - ### Method Detail

    - #### constructFor

          public static EnumResolver constructFor(java.lang.Class<java.lang.Enum<?>> enumCls,
                                  AnnotationIntrospector ai)

      Factory method for constructing resolver that maps from Enum.name() into Enum value

    - #### constructUsingToString

          @Deprecated
          public static EnumResolver constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls)

      Deprecated. Since 2.8, use `constructUsingToString(Class, AnnotationIntrospector)` instead

    - #### constructUsingToString

          public static EnumResolver constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls,
                                            AnnotationIntrospector ai)

      Factory method for constructing resolver that maps from Enum.toString() into Enum value
      Since:
        2.8

    - #### constructUsingMethod

          @Deprecated
          public static EnumResolver constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls,
                                                     java.lang.reflect.Method accessor)

      Deprecated. Since 2.8, use `constructUsingMethod(Class, Method, AnnotationIntrospector)` instead

    - #### constructUsingMethod

          public static EnumResolver constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls,
                                          java.lang.reflect.Method accessor,
                                          AnnotationIntrospector ai)

      Since:
        2.8

    - #### constructUnsafe

          public static EnumResolver constructUnsafe(java.lang.Class<?> rawEnumCls,
                                     AnnotationIntrospector ai)

      This method is needed because of the dynamic nature of constructing Enum resolvers.

    - #### constructUnsafeUsingToString

          @Deprecated
          public static EnumResolver constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls)

      Deprecated. Since 2.8, use `constructUnsafeUsingToString(Class, AnnotationIntrospector)` instead

    - #### constructUnsafeUsingToString

          public static EnumResolver constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls,
                                                  AnnotationIntrospector ai)

      Method that needs to be used instead of `constructUsingToString(java.lang.Class<java.lang.Enum<?>>)` if static type of enum is not known.
      Since:
        2.8

    - #### constructUnsafeUsingMethod

          @Deprecated
          public static EnumResolver constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls,
                                                           java.lang.reflect.Method accessor)

      Deprecated. Since 2.8, use `constructUnsafeUsingMethod(Class, Method, AnnotationIntrospector)` instead.

    - #### constructUnsafeUsingMethod

          public static EnumResolver constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls,
                                                java.lang.reflect.Method accessor,
                                                AnnotationIntrospector ai)

      Method used when actual String serialization is indicated using @JsonValue on a method.
      Since:
        2.8

    - #### constructLookup

          public CompactStringObjectMap constructLookup()

    - #### findEnum

          public java.lang.Enum<?> findEnum(java.lang.String key)

    - #### getEnum

          public java.lang.Enum<?> getEnum(int index)

    - #### getDefaultValue

          public java.lang.Enum<?> getDefaultValue()

    - #### getRawEnums

          public java.lang.Enum<?>[] getRawEnums()

    - #### getEnums

          public java.util.List<java.lang.Enum<?>> getEnums()

    - #### getEnumIds

          public java.util.Collection<java.lang.String> getEnumIds()

      Since:
        2.7.3

    - #### getEnumClass

          public java.lang.Class<java.lang.Enum<?>> getEnumClass()

    - #### lastValidIndex

          public int lastValidIndex()