Java Code Examples for com.fasterxml.jackson.databind.ObjectMapper#constructType()
The following examples show how to use
com.fasterxml.jackson.databind.ObjectMapper#constructType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonStreamingArrayParser.java From emodb with Apache License 2.0 | 6 votes |
private JsonStreamingArrayParser(InputStream in, ObjectMapper mapper, Type elementType) { try { JavaType javaType = mapper.constructType(elementType); //noinspection unchecked _type = (Class<? extends T>) javaType.getRawClass(); _jp = mapper.getFactory().createJsonParser(in); _reader = mapper.reader(javaType); // Parse at least the first byte of the response to make sure the input stream is valid. if (_jp.nextToken() != JsonToken.START_ARRAY) { throw new JsonParseException("Invalid JSON response, expected content to start with '[': " + _jp.getCurrentToken(), _jp.getTokenLocation()); } } catch (Exception e) { throw Throwables.propagate(e); } }
Example 2
Source File: JacksonPropertyNodeNameProvider.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private String getJavaBeanPropertyName(JavaBeanProperty property) { ObjectMapper objectMapper = DatabindCodec.mapper(); JavaType type = objectMapper.constructType(property.getDeclaringClass()); BeanDescription desc = objectMapper.getSerializationConfig().introspect(type); return desc.findProperties() .stream() .filter(prop -> prop.getInternalName().equals(property.getName())) .map(BeanPropertyDefinition::getName) .findFirst() .orElse(property.getName()); }
Example 3
Source File: JsonBeanRequestHandler.java From netty-rest with Apache License 2.0 | 5 votes |
public JsonBeanRequestHandler(HttpServer httpServer, ObjectMapper mapper, Method method, List<RequestPreprocessor> requestPreprocessors, HttpService service) { this.httpServer = httpServer; this.mapper = mapper; this.service = service; function = Lambda.produceLambdaForBiFunction(method); isAsync = CompletionStage.class.isAssignableFrom(method.getReturnType()); jsonClazz = mapper.constructType(method.getParameters()[0].getParameterizedType()); this.requestPreprocessors = requestPreprocessors; }
Example 4
Source File: IRequestParameter.java From netty-rest with Apache License 2.0 | 5 votes |
BodyParameter(ObjectMapper mapper, String name, Type type, boolean required) { this.name = name; this.type = mapper.constructType(type); this.mapper = mapper; this.required = required; }
Example 5
Source File: IRequestParameter.java From netty-rest with Apache License 2.0 | 4 votes |
FullBodyParameter(ObjectMapper mapper, Type type) { this.type = mapper.constructType(type); this.mapper = mapper; }
Example 6
Source File: RosettaMapper.java From Rosetta with Apache License 2.0 | 4 votes |
public RosettaMapper(Type type, ObjectMapper objectMapper, String tableName) { this.type = objectMapper.constructType(type); this.objectMapper = objectMapper; this.tableName = tableName; }