Sha256: 682e825785b6b88c5cde07def51dd6035f8146f958621e0d29ccfddfe57fb527

Contents?: true

Size: 1.95 KB

Versions: 164

Compression:

Stored size: 1.95 KB

Contents

package sh.calaba.org.codehaus.jackson.map.deser.std;

import java.io.IOException;

import sh.calaba.org.codehaus.jackson.JsonParser;
import sh.calaba.org.codehaus.jackson.JsonProcessingException;
import sh.calaba.org.codehaus.jackson.JsonToken;
import sh.calaba.org.codehaus.jackson.map.DeserializationContext;
import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl;

/**
 * 
 * @since 1.9 (renamed from 'sh.calaba.org.codehaus.jackson.map.deser.StdDeserializer#ClassDeserializer')
 */
@JacksonStdImpl
public class ClassDeserializer
    extends StdScalarDeserializer<Class<?>>
{
    public ClassDeserializer() { super(Class.class); }

    @Override
    public Class<?> deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
        JsonToken curr = jp.getCurrentToken();
        // Currently will only accept if given simple class name
        if (curr == JsonToken.VALUE_STRING) {
            String className = jp.getText();
            // [JACKSON-597]: support primitive types (and void)
            if (className.indexOf('.') < 0) {
                if ("int".equals(className)) return Integer.TYPE;
                if ("long".equals(className)) return Long.TYPE;
                if ("float".equals(className)) return Float.TYPE;
                if ("double".equals(className)) return Double.TYPE;
                if ("boolean".equals(className)) return Boolean.TYPE;
                if ("byte".equals(className)) return Byte.TYPE;
                if ("char".equals(className)) return Character.TYPE;
                if ("short".equals(className)) return Short.TYPE;
                if ("void".equals(className)) return Void.TYPE;
            }
            try {
                return Class.forName(jp.getText());
            } catch (ClassNotFoundException e) {
                throw ctxt.instantiationException(_valueClass, e);
            }
        }
        throw ctxt.mappingException(_valueClass, curr);
    }
}

Version data entries

164 entries across 164 versions & 2 rubygems

Version Path
calabash-android-0.4.20.1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.2 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.2.pre1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.0 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.0.pre2 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.5.0.pre1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.22.pre4 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.22.pre3 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.22.pre1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.21 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.20 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.19 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.19.pre4 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.19.pre3 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.19.pre2 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.19.pre1 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.18 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.16 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java
calabash-android-0.4.15.pre2 test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java