Class 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
    • Method Detail

      • constructFor

        public static EnumResolver constructFor​(DeserializationConfig config,
                                                java.lang.Class<?> enumCls)
        Factory method for constructing resolver that maps from Enum.name() into Enum value.
        Since:
        2.12
      • constructUsingToString

        public static EnumResolver constructUsingToString​(DeserializationConfig config,
                                                          java.lang.Class<?> enumCls)
        Factory method for constructing resolver that maps from Enum.toString() into Enum value
        Since:
        2.12
      • constructUsingMethod

        public static EnumResolver constructUsingMethod​(DeserializationConfig config,
                                                        java.lang.Class<?> enumCls,
                                                        AnnotatedMember accessor)
        Method used when actual String serialization is indicated using @JsonValue on a method in Enum class.
        Since:
        2.12
      • constructUsingToString

        @Deprecated
        public static EnumResolver constructUsingToString​(java.lang.Class<java.lang.Enum<?>> enumCls,
                                                          AnnotationIntrospector ai)
        Deprecated.
        Since 2.12
      • constructUnsafeUsingToString

        @Deprecated
        public static EnumResolver constructUnsafeUsingToString​(java.lang.Class<?> rawEnumCls,
                                                                AnnotationIntrospector ai)
        Deprecated.
        Since 2.12
        Since:
        2.8
      • constructUsingToString

        @Deprecated
        public static EnumResolver constructUsingToString​(java.lang.Class<java.lang.Enum<?>> enumCls)
        Deprecated.
        Since 2.8 (remove from 2.13 or later)
      • 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()
      • isFromIntValue

        public boolean isFromIntValue()
        Accessor for checking if we have a special case in which value to map is from @JsonValue annotated accessor with integral type: this matters for cases where incoming content value is of integral type and should be mapped to specific value and NOT to Enum.index().
        Since:
        2.13