Java 类org.codehaus.jackson.type.JavaType 实例源码

项目:talchain    文件:DifficultyTestSuite.java   
public DifficultyTestSuite(String json) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, DifficultyTestCase.class);

    Map<String, DifficultyTestCase> caseMap = new ObjectMapper().readValue(json, type);

    for (Map.Entry<String, DifficultyTestCase> e : caseMap.entrySet()) {
        e.getValue().setName(e.getKey());
        testCases.add(e.getValue());
    }

    Collections.sort(testCases, new Comparator<DifficultyTestCase>() {
        @Override
        public int compare(DifficultyTestCase t1, DifficultyTestCase t2) {
            return t1.getName().compareTo(t2.getName());
        }
    });
}
项目:AppCoins-ethereumj    文件:DifficultyTestSuite.java   
public DifficultyTestSuite(String json) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, DifficultyTestCase.class);

    Map<String, DifficultyTestCase> caseMap = new ObjectMapper().readValue(json, type);

    for (Map.Entry<String, DifficultyTestCase> e : caseMap.entrySet()) {
        e.getValue().setName(e.getKey());
        testCases.add(e.getValue());
    }

    Collections.sort(testCases, new Comparator<DifficultyTestCase>() {
        @Override
        public int compare(DifficultyTestCase t1, DifficultyTestCase t2) {
            return t1.getName().compareTo(t2.getName());
        }
    });
}
项目:fountain    文件:JsonUtils.java   
@SuppressWarnings("deprecation")
   public static Object json2Object(String jsonString, JavaType type) {

    if (jsonString == null || "".equals(jsonString)) {
        return "";
    } else {
        try {
            objectMapper.getDeserializationConfig().set(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            return objectMapper.readValue(jsonString, type);
        } catch (Exception e) {
            log.warn("json error:" + e.getMessage());
        }

    }
    return "";
}
项目:es-hadoop-v2.2.0    文件:BackportedObjectReader.java   
/**
 * Method called to locate deserializer for the passed root-level value.
 */
protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType)
        throws JsonMappingException {

    // Sanity check: must have actual type...
    if (valueType == null) {
        throw new JsonMappingException("No value type configured for ObjectReader");
    }

    // First: have we already seen it?
    JsonDeserializer<Object> deser = _rootDeserializers.get(valueType);
    if (deser != null) {
        return deser;
    }

    // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method)
    // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if

    // Nope: need to ask provider to resolve it
    deser = _provider.findTypedValueDeserializer(cfg, valueType);
    if (deser == null) { // can this happen?
        throw new JsonMappingException("Can not find a deserializer for type " + valueType);
    }
    _rootDeserializers.put(valueType, deser);
    return deser;
}
项目:es-hadoop-v2.2.0    文件:BackportedJacksonMappingIterator.java   
@SuppressWarnings("unchecked")
protected BackportedJacksonMappingIterator(JavaType type, JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser) {
    _type = type;
    _parser = jp;
    _context = ctxt;
    _deserializer = (JsonDeserializer<T>) deser;

    /* One more thing: if we are at START_ARRAY (but NOT root-level
     * one!), advance to next token (to allow matching END_ARRAY)
     */
    if (jp != null && jp.getCurrentToken() == JsonToken.START_ARRAY) {
        JsonStreamContext sc = jp.getParsingContext();
        // safest way to skip current token is to clear it (so we'll advance soon)
        if (!sc.inRoot()) {
            jp.clearCurrentToken();
        }
    }
}
项目:flume-enrichment-interceptor-skeleton    文件:EnrichedEventBodyGeneric.java   
public static <T> EnrichedEventBodyGeneric createFromEventBody(byte[] payload, boolean isEnriched, Class<T> clazz) throws IOException {

        EnrichedEventBodyGeneric enrichedEventBodyGeneric;

        if (isEnriched) {
            JavaType javaType = JSONStringSerializer.getJavaType(EnrichedEventBodyGeneric.class, clazz);
            enrichedEventBodyGeneric = (EnrichedEventBodyGeneric) JSONStringSerializer.fromBytes(payload, javaType);
        } else {
            // Detecting payload charset
            UniversalDetector detector = new UniversalDetector(null);
            detector.handleData(payload, 0, payload.length);
            detector.dataEnd();
            String charset = detector.getDetectedCharset();
            detector.reset();

            if (charset == null) {
                charset = DEFAULT_CHARSET;
            }
           enrichedEventBodyGeneric = new EnrichedEventBodyGeneric(new String(payload, charset), clazz);
        }

        return enrichedEventBodyGeneric;
    }
项目:appverse-server    文件:CustomMappingJacksonHttpMessageConverter.java   
@Override
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
        throws IOException, HttpMessageNotReadableException {
    BufferedReader bufferedReader = new BufferedReader(
            new InputStreamReader(inputMessage.getBody(), DEFAULT_CHARSET));
    StringBuilder stringBuilder = new StringBuilder();
    String line = null;

    while ((line = bufferedReader.readLine()) != null) {
        stringBuilder.append(line + " ");
    }

    logger.debug("Middleware recieves " + clazz.getName() + " "
            + stringBuilder.toString());
    JavaType javaType = getJavaType(clazz);
    return this.objectMapper.readValue(stringBuilder.toString(), javaType);
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
public JsonSerializer<Object> findValueSerializer(JavaType paramJavaType, BeanProperty paramBeanProperty)
  throws JsonMappingException
{
  JsonSerializer localJsonSerializer = this._knownSerializers.untypedValueSerializer(paramJavaType);
  if (localJsonSerializer == null)
  {
    localJsonSerializer = this._serializerCache.untypedValueSerializer(paramJavaType);
    if (localJsonSerializer == null)
    {
      localJsonSerializer = _createAndCacheUntypedSerializer(paramJavaType, paramBeanProperty);
      if (localJsonSerializer == null)
        return getUnknownTypeSerializer(paramJavaType.getRawClass());
    }
  }
  if ((localJsonSerializer instanceof ContextualSerializer))
    return ((ContextualSerializer)localJsonSerializer).createContextual(this._config, paramBeanProperty);
  return localJsonSerializer;
}
项目:12306-android-Decompile    文件:BeanDeserializerFactory.java   
public KeyDeserializer createKeyDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, BeanProperty paramBeanProperty)
  throws JsonMappingException
{
  if (this._factoryConfig.hasKeyDeserializers())
  {
    BasicBeanDescription localBasicBeanDescription = (BasicBeanDescription)paramDeserializationConfig.introspectClassAnnotations(paramJavaType.getRawClass());
    Iterator localIterator = this._factoryConfig.keyDeserializers().iterator();
    while (localIterator.hasNext())
    {
      KeyDeserializer localKeyDeserializer = ((KeyDeserializers)localIterator.next()).findKeyDeserializer(paramJavaType, paramDeserializationConfig, localBasicBeanDescription, paramBeanProperty);
      if (localKeyDeserializer != null)
        return localKeyDeserializer;
    }
  }
  return null;
}
项目:test-html-generator-plugin    文件:MapSerializer.java   
protected MapSerializer(HashSet<String> ignoredEntries,
        JavaType keyType, JavaType valueType, boolean valueTypeIsStatic,
        TypeSerializer vts,
        JsonSerializer<Object> keySerializer, JsonSerializer<Object> valueSerializer, 
        BeanProperty property)
{
    super(Map.class, false);
    _property = property;
    _ignoredEntries = ignoredEntries;
    _keyType = keyType;
    _valueType = valueType;
    _valueTypeIsStatic = valueTypeIsStatic;
    _valueTypeSerializer = vts;
    _keySerializer = keySerializer;
    _valueSerializer = valueSerializer;
    _dynamicValueSerializers = PropertySerializerMap.emptyMap();
}
项目:typescript-generator    文件:Jackson1Parser.java   
private BeanHelper getBeanHelper(Class<?> beanClass) {
    if (beanClass == null) {
        return null;
    }
    try {
        final SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
        final JavaType simpleType = objectMapper.constructType(beanClass);
        final JsonSerializer<?> jsonSerializer = BeanSerializerFactory.instance.createSerializer(serializationConfig, simpleType, null);
        if (jsonSerializer == null) {
            return null;
        }
        if (jsonSerializer instanceof BeanSerializer) {
            return new BeanHelper((BeanSerializer) jsonSerializer);
        } else {
            final String jsonSerializerName = jsonSerializer.getClass().getName();
            throw new RuntimeException(String.format("Unknown serializer '%s' for class '%s'", jsonSerializerName, beanClass));
        }
    } catch (JsonMappingException e) {
        throw new RuntimeException(e);
    }
}
项目:12306-android-Decompile    文件:BasicDeserializerFactory.java   
public JsonDeserializer<?> createCollectionLikeDeserializer(DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, CollectionLikeType paramCollectionLikeType, BeanProperty paramBeanProperty)
  throws JsonMappingException
{
  CollectionLikeType localCollectionLikeType1 = (CollectionLikeType)mapAbstractType(paramDeserializationConfig, paramCollectionLikeType);
  BasicBeanDescription localBasicBeanDescription = (BasicBeanDescription)paramDeserializationConfig.introspectClassAnnotations(localCollectionLikeType1.getRawClass());
  JsonDeserializer localJsonDeserializer1 = findDeserializerFromAnnotation(paramDeserializationConfig, localBasicBeanDescription.getClassInfo(), paramBeanProperty);
  if (localJsonDeserializer1 != null)
    return localJsonDeserializer1;
  CollectionLikeType localCollectionLikeType2 = (CollectionLikeType)modifyTypeByAnnotation(paramDeserializationConfig, localBasicBeanDescription.getClassInfo(), localCollectionLikeType1, null);
  JavaType localJavaType = localCollectionLikeType2.getContentType();
  JsonDeserializer localJsonDeserializer2 = (JsonDeserializer)localJavaType.getValueHandler();
  TypeDeserializer localTypeDeserializer = (TypeDeserializer)localJavaType.getTypeHandler();
  if (localTypeDeserializer == null)
    localTypeDeserializer = findTypeDeserializer(paramDeserializationConfig, localJavaType, paramBeanProperty);
  return _findCustomCollectionLikeDeserializer(localCollectionLikeType2, paramDeserializationConfig, paramDeserializerProvider, localBasicBeanDescription, paramBeanProperty, localTypeDeserializer, localJsonDeserializer2);
}
项目:12306-android-Decompile    文件:TypeBindings.java   
protected void _resolve()
{
  _resolveBindings(this._contextClass);
  if (this._contextType != null)
  {
    int i = this._contextType.containedTypeCount();
    if (i > 0)
    {
      if (this._bindings == null)
        this._bindings = new LinkedHashMap();
      for (int j = 0; j < i; j++)
      {
        String str = this._contextType.containedTypeName(j);
        JavaType localJavaType = this._contextType.containedType(j);
        this._bindings.put(str, localJavaType);
      }
    }
  }
  if (this._bindings == null)
    this._bindings = Collections.emptyMap();
}
项目:12306-android-Decompile    文件:BeanDeserializerFactory.java   
protected SettableAnyProperty constructAnySetter(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, AnnotatedMethod paramAnnotatedMethod)
  throws JsonMappingException
{
  if (paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
    paramAnnotatedMethod.fixAccess();
  JavaType localJavaType1 = paramBasicBeanDescription.bindingsForBeanType().resolveType(paramAnnotatedMethod.getParameterType(1));
  BeanProperty.Std localStd = new BeanProperty.Std(paramAnnotatedMethod.getName(), localJavaType1, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedMethod);
  JavaType localJavaType2 = resolveType(paramDeserializationConfig, paramBasicBeanDescription, localJavaType1, paramAnnotatedMethod, localStd);
  JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationConfig, paramAnnotatedMethod, localStd);
  if (localJsonDeserializer != null)
  {
    SettableAnyProperty localSettableAnyProperty = new SettableAnyProperty(localStd, paramAnnotatedMethod, localJavaType2);
    localSettableAnyProperty.setValueDeserializer(localJsonDeserializer);
    return localSettableAnyProperty;
  }
  return new SettableAnyProperty(localStd, paramAnnotatedMethod, modifyTypeByAnnotation(paramDeserializationConfig, paramAnnotatedMethod, localJavaType2, localStd.getName()));
}
项目:12306-android-Decompile    文件:JacksonAnnotationIntrospector.java   
public Class<?> findDeserializationKeyType(Annotated paramAnnotated, JavaType paramJavaType, String paramString)
{
  JsonDeserialize localJsonDeserialize = (JsonDeserialize)paramAnnotated.getAnnotation(JsonDeserialize.class);
  Class localClass;
  if (localJsonDeserialize != null)
  {
    localClass = localJsonDeserialize.keyAs();
    if (localClass == NoClass.class);
  }
  do
  {
    return localClass;
    JsonKeyClass localJsonKeyClass = (JsonKeyClass)paramAnnotated.getAnnotation(JsonKeyClass.class);
    if (localJsonKeyClass == null)
      break;
    localClass = localJsonKeyClass.value();
  }
  while (localClass != NoClass.class);
  return null;
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
protected TypeIdResolver idResolver(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (this._customIdResolver != null)
    return this._customIdResolver;
  if (this._idType == null)
    throw new IllegalStateException("Can not build, 'init()' not yet called");
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$Id[this._idType.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type id resolver for idType: " + this._idType);
  case 1:
    return new ClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 2:
    return new MinimalClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 3:
  }
  return TypeNameIdResolver.construct(paramMapperConfig, paramJavaType, paramCollection, paramBoolean1, paramBoolean2);
}
项目:12306-android-Decompile    文件:TypeFactory.java   
public JavaType[] findTypeParameters(JavaType paramJavaType, Class<?> paramClass)
{
  Class localClass = paramJavaType.getRawClass();
  if (localClass == paramClass)
  {
    int i = paramJavaType.containedTypeCount();
    JavaType[] arrayOfJavaType;
    if (i == 0)
      arrayOfJavaType = null;
    while (true)
    {
      return arrayOfJavaType;
      arrayOfJavaType = new JavaType[i];
      for (int j = 0; j < i; j++)
        arrayOfJavaType[j] = paramJavaType.containedType(j);
    }
  }
  return findTypeParameters(localClass, paramClass, new TypeBindings(this, paramJavaType));
}
项目:12306-android-Decompile    文件:StdDeserializerProvider.java   
public JsonDeserializer<Object> findValueDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, BeanProperty paramBeanProperty)
  throws JsonMappingException
{
  JsonDeserializer localJsonDeserializer1 = _findCachedDeserializer(paramJavaType);
  if (localJsonDeserializer1 != null)
  {
    if ((localJsonDeserializer1 instanceof ContextualDeserializer))
      localJsonDeserializer1 = ((ContextualDeserializer)localJsonDeserializer1).createContextual(paramDeserializationConfig, paramBeanProperty);
    return localJsonDeserializer1;
  }
  JsonDeserializer localJsonDeserializer2 = _createAndCacheValueDeserializer(paramDeserializationConfig, paramJavaType, paramBeanProperty);
  if (localJsonDeserializer2 == null)
    localJsonDeserializer2 = _handleUnknownValueDeserializer(paramJavaType);
  if ((localJsonDeserializer2 instanceof ContextualDeserializer))
    localJsonDeserializer2 = ((ContextualDeserializer)localJsonDeserializer2).createContextual(paramDeserializationConfig, paramBeanProperty);
  return localJsonDeserializer2;
}
项目:Android-IndexListview    文件:FileUtils.java   
public static CityListCityModel[] readCityList()
{
    List<CityListCityModel> list = new ArrayList<CityListCityModel>();
    CityListCityModel cities[];
    String json = readAssertsFile("city.json", IndexListviewApplication.getContext());
    try {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        JavaType javaType = mapper.getTypeFactory().constructParametricType(ArrayList.class, CityListCityModel.class);
        list = mapper.readValue(json.toString(), javaType);
    } catch (Exception e) {
        e.printStackTrace();
    }
    cities = list.toArray(new CityListCityModel[list.size()]);
    return cities;
}
项目:jforgame    文件:JsonUtils.java   
@SuppressWarnings("unchecked")
public static <T> T string2Object(String json, Class<T> clazz) {
    JavaType type = typeFactory.constructType(clazz);
    try {
        return (T) mapper.readValue(json, type);
    } catch(Exception e) {
        return null;
    }
}
项目:jforgame    文件:JsonUtils.java   
public static Map<String, Object> string2Map(String json) {
    JavaType type = typeFactory.constructMapType(HashMap.class, String.class, Object.class);
    try {
        return mapper.readValue(json, type);
    } catch(Exception e) {
        return null;
    }
}
项目:jforgame    文件:JsonUtils.java   
public static <K, V> Map<K, V> string2Map(String json, Class<K> keyClazz, Class<V> valueClazz) {
    JavaType type = typeFactory.constructMapType(HashMap.class, keyClazz, valueClazz);
    try {
        return mapper.readValue(json, type);
    } catch(Exception e) {
        return null;
    }
}
项目:jforgame    文件:JsonUtils.java   
@SuppressWarnings("unchecked")
public static <T> T[] string2Array(String json, Class<T> clazz) {
    JavaType type = ArrayType.construct(typeFactory.constructType(clazz));
    try {
        return (T[]) mapper.readValue(json, type);
    } catch(Exception e) {
        return null;
    }
}
项目:jforgame    文件:JsonUtils.java   
public static <C extends Collection<E>, E> C string2Collection(String json, Class<C> collectionType,
        Class<E> elemType) {
    JavaType type = typeFactory.constructCollectionType(collectionType, elemType);
    try {
        return mapper.readValue(json, type);
    } catch(Exception e) {
        return null;
    }                                                   
}
项目:talchain    文件:TransactionTestSuite.java   
public TransactionTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, TransactionTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:talchain    文件:EthashTestSuite.java   
public EthashTestSuite(String json) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, EthashTestCase.class);

    Map<String, EthashTestCase> caseMap = new ObjectMapper().readValue(json, type);

    for (Map.Entry<String, EthashTestCase> e : caseMap.entrySet()) {
        e.getValue().setName(e.getKey());
        testCases.add(e.getValue());
    }
}
项目:talchain    文件:BlockTestSuite.java   
public BlockTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, BlockTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:talchain    文件:StateTestSuite.java   
public StateTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, StateTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:talchain    文件:GitHubRLPTest.java   
@BeforeClass
public static void init() throws ParseException, IOException {
    logger.info("    Initializing RLP tests...");
    String json = JSONReader.loadJSON("RLPTests/rlptest.json");

    Assume.assumeFalse("Online test is not available", json.equals(""));

    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, RLPTestCase.class);

    TEST_SUITE = mapper.readValue(json, type);
}
项目:lams    文件:MappingJacksonHttpMessageConverter.java   
@Override
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
        throws IOException, HttpMessageNotReadableException {

    JavaType javaType = getJavaType(clazz, null);
    return readJavaType(javaType, inputMessage);
}
项目:lams    文件:MappingJacksonHttpMessageConverter.java   
@Override
public Object read(Type type, Class<?> contextClass, HttpInputMessage inputMessage)
        throws IOException, HttpMessageNotReadableException {

    JavaType javaType = getJavaType(type, contextClass);
    return readJavaType(javaType, inputMessage);
}
项目:lams    文件:MappingJacksonHttpMessageConverter.java   
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) {
    try {
        return this.objectMapper.readValue(inputMessage.getBody(), javaType);
    }
    catch (IOException ex) {
        throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
    }
}
项目:AppCoins-ethereumj    文件:StateTestData.java   
public StateTestData(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, StateTestDataEntry.class);

        testData = new ObjectMapper().readValue(json, type);
    }
项目:AppCoins-ethereumj    文件:TransactionTestSuite.java   
public TransactionTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, TransactionTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:AppCoins-ethereumj    文件:EthashTestSuite.java   
public EthashTestSuite(String json) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, EthashTestCase.class);

    Map<String, EthashTestCase> caseMap = new ObjectMapper().readValue(json, type);

    for (Map.Entry<String, EthashTestCase> e : caseMap.entrySet()) {
        e.getValue().setName(e.getKey());
        testCases.add(e.getValue());
    }
}
项目:AppCoins-ethereumj    文件:BlockTestSuite.java   
public BlockTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, BlockTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:AppCoins-ethereumj    文件:StateTestSuite.java   
public StateTestSuite(String json) throws IOException {

        ObjectMapper mapper = new ObjectMapper();
        JavaType type = mapper.getTypeFactory().
                constructMapType(HashMap.class, String.class, StateTestCase.class);

        testCases = new ObjectMapper().readValue(json, type);
    }
项目:AppCoins-ethereumj    文件:GitHubRLPTest.java   
@BeforeClass
public static void init() throws ParseException, IOException {
    logger.info("    Initializing RLP tests...");
    String json = JSONReader.loadJSON("RLPTests/rlptest.json");

    Assume.assumeFalse("Online test is not available", json.equals(""));

    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().
            constructMapType(HashMap.class, String.class, RLPTestCase.class);

    TEST_SUITE = mapper.readValue(json, type);
}
项目:es-hadoop-v2.2.0    文件:BackportedObjectReader.java   
/**
 * Constructor used by {@link ObjectMapper} for initial instantiation
 */
protected BackportedObjectReader(ObjectMapper mapper, JavaType valueType, Object valueToUpdate) {
    _rootDeserializers = ReflectionUtils.getField(ROOT_DESERIALIZERS, mapper);
    _provider = mapper.getDeserializerProvider();
    _jsonFactory = mapper.getJsonFactory();

    // must make a copy at this point, to prevent further changes from trickling down
    _config = mapper.copyDeserializationConfig();

    _valueType = valueType;
    _valueToUpdate = valueToUpdate;
    if (valueToUpdate != null && valueType.isArrayType()) {
        throw new IllegalArgumentException("Can not update an array value");
    }
}
项目:apex-core    文件:LogicalPlanSerializer.java   
@Override
public boolean useForType(JavaType t)
{
  if (t.getRawClass() == Object.class) {
    return true;
  }
  if (t.getRawClass().getName().startsWith("java.")) {
    return false;
  }
  if (t.isArrayType()) {
    return false;
  }
  return super.useForType(t);
}