Examples of EnumValues


Examples of org.codehaus.jackson.map.util.EnumValues

            jgen.writeStartObject();
            JsonSerializer<Object> prevSerializer = null;
            Class<?> prevClass = null;

            // for efficient key serialization, we need this:
            EnumValues enumValues = null;

            for (Map.Entry<? extends Enum<?>,?> entry : value.entrySet()) {
                // First, serialize key
                Enum<?> key = entry.getKey();
                if (enumValues == null) {
                    /* 15-Oct-2009, tatu: This is bit clumsy, but still the
                     * simplest efficient way to do it currently,
                     * as Serializers get cached.
                     * (it does assume we'll always use default serializer
                     * tho -- so ideally code should be rewritten)
                     */
                    // ... and lovely two-step casting process too...
                    SerializerBase<?> ser = (SerializerBase<?>) provider.findValueSerializer(key.getDeclaringClass());
                    enumValues = ((EnumSerializer) ser).getEnumValues();
                }
                jgen.writeFieldName(enumValues.valueFor(key));
                // And then value
                Object valueElem = entry.getValue();
                if (valueElem == null) {
                    provider.getNullValueSerializer().serialize(null, jgen, provider);
                } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.