Package org.codehaus.jackson.type

Examples of org.codehaus.jackson.type.JavaType


            throw new IllegalArgumentException("Invalid sub type: "+aClass+", of base type: "+baseType.getRawClass());
        return rc;
    }

    public JavaType typeFromId(String id) {
        JavaType rc = idToType.get(id);
        if(rc==null)
            throw new IllegalArgumentException("Invalid type id '"+id);
        return rc;
    }
View Full Code Here


        }

        try {
            Class<?> cls = context.getTargetDataType().getPhysical();
            ObjectMapper mapper = JacksonHelper.createObjectMapper(cls);
            JavaType javaType = TypeFactory.type(context.getTargetDataType().getGenericType());
            if (source instanceof String) {
              String sourceString = (String) source;
              if(sourceString.isEmpty()) {
                return sourceString;
              } else {
View Full Code Here

    }
  }

  protected Object deserializeJsonObject(String className, byte[] data) {
    try {
      JavaType type = TypeFactory.fromCanonical(className);

      return objectMapper.readValue(new String(data, Charset.forName("UTF-8")), type);

    } catch(Exception e) {
      throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, "Could not deserialize JSON object: "+e.getMessage());
View Full Code Here

            throw new IllegalArgumentException("Invalid sub type: "+value.getClass()+", of base type: "+baseType.getRawClass());
        return rc;
    }

    public JavaType typeFromId(String id) {
        JavaType rc = idToType.get(id);
        if(rc==null)
            throw new IllegalArgumentException("Invalid type id '"+id);
        return rc;
    }
View Full Code Here

  public static ObjectReader createReader(Type type)
  {
    ObjectMapper mapper = getObjectMapper(type);
    setGlobalConfigurations(mapper);
    JavaType paramJavaType = mapper.getTypeFactory().constructType(type);
    ObjectReader reader = mapper.reader(paramJavaType);
    return reader;
  }
View Full Code Here

  public static ObjectWriter createWriter(Type type)
  {
    ObjectMapper mapper = getObjectMapper(type);
    setGlobalConfigurations(mapper);
    JavaType paramJavaType = mapper.getTypeFactory().constructType(type);
    ObjectWriter writer = mapper.writerWithType(paramJavaType);
    return writer;
  }
View Full Code Here

     */
    public ValueInstantiator constructValueInstantiator(DeserializationConfig config)
    {
        StdValueInstantiator inst = new StdValueInstantiator(config, _beanDesc.getType());

        JavaType delegateType;

        if (_delegateCreator == null) {
            delegateType = null;
        } else {
            TypeBindings bindings = _beanDesc.bindingsForBeanType();
View Full Code Here

        if (source == null) {
            return null;
        }

        try {
            JavaType javaType = TypeFactory.type(context.getTargetDataType().getGenericType());
            if (source instanceof String) {
              String sourceString = (String) source;
              if(sourceString.isEmpty()) {
                return sourceString;
              } else {
View Full Code Here

  public boolean canRead(Class<?> clazz, MediaType mediaType) {
    return canRead((Type) clazz, null, mediaType);
  }

  public boolean canRead(Type type, Class<?> contextClass, MediaType mediaType) {
    JavaType javaType = getJavaType(type, contextClass);
    return (this.objectMapper.canDeserialize(javaType) && 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

TOP

Related Classes of org.codehaus.jackson.type.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.