public static EnumValues constructFromToString(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { map.put(en, new SerializedString(en.toString())); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { // First things first: if not empty, easy to determine if (!s.isEmpty()) { return findEnumType(s.iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(s); }
public static EnumValues constructFromName(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { /* [JACKSON-214]: Enum types with per-instance sub-classes * need special handling */ Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { String value = intr.findEnumValue(en); map.put(en, new SerializedString(value)); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m) { if (!m.isEmpty()) { return findEnumType(m.keySet().iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(m); }
Class<?> enumClass = ClassUtil.findEnumType((EnumSet<?>) value); Class<?> enumClass = ClassUtil.findEnumType((EnumMap<?,?>) value); Class<?> valueClass = Object.class;
public static EnumValues constructFromToString(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { map.put(en, new SerializedString(en.toString())); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { // First things first: if not empty, easy to determine if (!s.isEmpty()) { return findEnumType(s.iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(s); }
public static EnumValues constructFromName(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { /* [JACKSON-214]: Enum types with per-instance sub-classes * need special handling */ Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { String value = intr.findEnumValue(en); map.put(en, new SerializedString(value)); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m) { if (!m.isEmpty()) { return findEnumType(m.keySet().iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(m); }
Class<?> enumClass = ClassUtil.findEnumType((EnumSet<?>) value); Class<?> enumClass = ClassUtil.findEnumType((EnumMap<?,?>) value); Class<?> valueClass = Object.class;
public static EnumValues constructFromToString(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { map.put(en, new SerializedString(en.toString())); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
public static EnumValues constructFromToString(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { map.put(en, new SerializedString(en.toString())); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
public static EnumValues constructFromToString(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { map.put(en, new SerializedString(en.toString())); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { // First things first: if not empty, easy to determine if (!s.isEmpty()) { return findEnumType(s.iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(s); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { // First things first: if not empty, easy to determine if (!s.isEmpty()) { return findEnumType(s.iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(s); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { // First things first: if not empty, easy to determine if (!s.isEmpty()) { return findEnumType(s.iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(s); }
public static EnumValues constructFromName(Class<Enum<?>> enumClass, AnnotationIntrospector intr) { /* [JACKSON-214]: Enum types with per-instance sub-classes * need special handling */ Class<? extends Enum<?>> cls = ClassUtil.findEnumType(enumClass); Enum<?>[] values = cls.getEnumConstants(); if (values != null) { // Type juggling... unfortunate Map<Enum<?>,SerializedString> map = new HashMap<Enum<?>,SerializedString>(); for (Enum<?> en : values) { String value = intr.findEnumValue(en); map.put(en, new SerializedString(value)); } return new EnumValues(map); } throw new IllegalArgumentException("Can not determine enum constants for Class "+enumClass.getName()); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m) { if (!m.isEmpty()) { return findEnumType(m.keySet().iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(m); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m) { if (!m.isEmpty()) { return findEnumType(m.keySet().iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(m); }
/** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design flaw in JDK. * * @since 1.5 */ public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m) { if (!m.isEmpty()) { return findEnumType(m.keySet().iterator().next()); } // Otherwise need to locate using an internal field return EnumTypeLocator.instance.enumTypeFor(m); }