Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JavaType


    protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
            Class<?> type, SerializerProvider provider) throws JsonMappingException
    {
        JsonSerializer<Object> serializer;
        if (_nonTrivialBaseType != null) {
            JavaType subtype = provider.constructSpecializedType(_nonTrivialBaseType, type);
            serializer = provider.findValueSerializer(subtype, this);
        } else {
            serializer = provider.findValueSerializer(type, this);
        }
        NameTransformer t = _nameTransformer;
View Full Code Here


    Assert.notNull(mapper, "ObjectMapper must not be null!");
    Assert.notNull(type, "Type must not be null!");

    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    JavaType javaType = serializationConfig.constructType(type);
    BeanDescription description = serializationConfig.introspect(javaType);

    this.definitions = description.findProperties();
  }
View Full Code Here

    // objectMapper.setDateFormat(new SimpleDateFormat("MM-dd-yyyy"));
  }

  @Override
  public boolean canRead(Class<?> clazz, MediaType mediaType) {
    JavaType javaType = getJavaType(clazz);
    return objectMapper.canDeserialize(javaType) && canRead(mediaType);
  }
View Full Code Here

  }

  @Override
  protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException,
      HttpMessageNotReadableException {
    JavaType javaType = getJavaType(clazz);
    try {
      return objectMapper.readValue(inputMessage.getBody(), javaType);
    } catch (JsonParseException ex) {
      throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
    }
View Full Code Here

        sortedLinks.put("curies", curies);
      }

      TypeFactory typeFactory = provider.getConfig().getTypeFactory();
      JavaType keyType = typeFactory.uncheckedSimpleType(String.class);
      JavaType valueType = typeFactory.constructCollectionType(ArrayList.class, Object.class);
      JavaType mapType = typeFactory.constructMapType(HashMap.class, keyType, valueType);

      MapSerializer serializer = MapSerializer.construct(new String[] {}, mapType, true, null,
          provider.findKeySerializer(keyType, null), new OptionalListJackson2Serializer(property), null);

      serializer.serialize(sortedLinks, jgen, provider);
View Full Code Here

    @Override
    public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
        throws JsonMappingException {

      JavaType vc = property.getType().getContentType();
      HalResourcesDeserializer des = new HalResourcesDeserializer(vc);
      return des;
    }
View Full Code Here

    return canRead(clazz, null, mediaType);
  }

  @Override
  public boolean canRead(Type type, Class<?> contextClass, MediaType mediaType) {
    JavaType javaType = getJavaType(type, contextClass);
    if (!jackson23Available || !logger.isWarnEnabled()) {
      return (this.objectMapper.canDeserialize(javaType) && canRead(mediaType));
    }
    AtomicReference<Throwable> causeRef = new AtomicReference<Throwable>();
    if (this.objectMapper.canDeserialize(javaType, causeRef) && canRead(mediaType)) {
View Full Code Here

  @Override
  protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
      throws IOException, HttpMessageNotReadableException {

    JavaType javaType = getJavaType(clazz, null);
    return readJavaType(javaType, inputMessage);
  }
View Full Code Here

  @Override
  public Object read(Type type, Class<?> contextClass, HttpInputMessage inputMessage)
      throws IOException, HttpMessageNotReadableException {

    JavaType javaType = getJavaType(type, contextClass);
    return readJavaType(javaType, inputMessage);
  }
View Full Code Here

  }

  @Override
  public Object fromMessage(Message message) throws JMSException, MessageConversionException {
    try {
      JavaType targetJavaType = getJavaTypeForMessage(message);
      return convertToObject(message, targetJavaType);
    }
    catch (IOException ex) {
      throw new MessageConversionException("Failed to convert JSON message content", ex);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.JavaType

Copyright © 2018 www.massapicom. 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.