use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jersey by jersey.
the class FilteringJacksonJaxbJsonProvider method _configForWriting.
@Override
protected JsonEndpointConfig _configForWriting(final ObjectMapper mapper, final Annotation[] annotations, final Class<?> defaultView) {
final AnnotationIntrospector customIntrospector = mapper.getSerializationConfig().getAnnotationIntrospector();
// Set the custom (user) introspector to be the primary one.
final ObjectMapper filteringMapper = mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(customIntrospector, new JacksonAnnotationIntrospector() {
@Override
public Object findFilterId(final Annotated a) {
final Object filterId = super.findFilterId(a);
if (filterId != null) {
return filterId;
}
if (a instanceof AnnotatedMethod) {
final Method method = ((AnnotatedMethod) a).getAnnotated();
// Interested only in getters - trying to obtain "field" name from them.
if (ReflectionHelper.isGetter(method)) {
return ReflectionHelper.getPropertyName(method);
}
}
if (a instanceof AnnotatedField || a instanceof AnnotatedClass) {
return a.getName();
}
return null;
}
}));
return super._configForWriting(filteringMapper, annotations, defaultView);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project hadoop by apache.
the class YarnJacksonJaxbJsonProvider method locateMapper.
@Override
public ObjectMapper locateMapper(Class<?> type, MediaType mediaType) {
ObjectMapper mapper = super.locateMapper(type, mediaType);
configObjectMapper(mapper);
return mapper;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project storm by apache.
the class TridentSocketSpout method open.
@Override
public void open(Map conf, TopologyContext context) {
this.queue = new LinkedBlockingDeque<>();
this.objectMapper = new ObjectMapper();
this.batches = new HashMap<>();
try {
socket = new Socket(host, port);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException e) {
throw new RuntimeException("Error opening socket: host " + host + " port " + port);
}
readerThread = new Thread(new SocketReaderRunnable());
readerThread.start();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project storm by apache.
the class RedisKeyValueStateProvider method getStateConfig.
StateConfig getStateConfig(Map stormConf) throws Exception {
StateConfig stateConfig = null;
String providerConfig = null;
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
if (stormConf.containsKey(org.apache.storm.Config.TOPOLOGY_STATE_PROVIDER_CONFIG)) {
providerConfig = (String) stormConf.get(org.apache.storm.Config.TOPOLOGY_STATE_PROVIDER_CONFIG);
stateConfig = mapper.readValue(providerConfig, StateConfig.class);
} else {
stateConfig = new StateConfig();
}
return stateConfig;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project hadoop by apache.
the class StatePool method read.
private void read(DataInput in) throws IOException {
ObjectMapper mapper = new ObjectMapper();
// define a module
SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL", "", ""));
// add the state deserializer
module.addDeserializer(StatePair.class, new StateDeserializer());
// register the module with the object-mapper
mapper.registerModule(module);
JsonParser parser = mapper.getFactory().createParser((DataInputStream) in);
StatePool statePool = mapper.readValue(parser, StatePool.class);
this.setStates(statePool.getStates());
parser.close();
}
Aggregations