/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { return _new(this, _config.withView(view)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ public ObjectWriter writerWithView(Class<?> serializationView) { return _newWriter(getSerializationConfig().withView(serializationView)); }
/** * Creates a {@link JsonMediaTypeCodec} for the view class (specified as the JsonView annotation value). * @param viewClass The view class * @return The codec */ @Override public @Nonnull JsonMediaTypeCodec resolveJsonViewCodec(@Nonnull Class<?> viewClass) { ArgumentUtils.requireNonNull("viewClass", viewClass); JsonMediaTypeCodec codec = jsonViewCodecs.get(viewClass); if (codec == null) { ObjectMapper viewMapper = objectMapper.copy(); viewMapper.setConfig(viewMapper.getSerializationConfig().withView(viewClass)); codec = new JsonMediaTypeCodec(viewMapper, applicationConfiguration, codecConfiguration); jsonViewCodecs.put(viewClass, codec); } return codec; } }
config = config.withView(jsonView); this.objectMapper.writeValue(generator, value, config);
public CustomObjectMapper(Class<?> viewClass) { super(); this._serializationConfig = this._serializationConfig.withView(viewClass); } }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { SerializationConfig newConfig = _config.withView(view); return (newConfig == _config) ? this : new ObjectWriter(this, newConfig); }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { SerializationConfig newConfig = _config.withView(view); return (newConfig == _config) ? this : _new(this, newConfig); }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { return _new(this, _config.withView(view)); }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { SerializationConfig newConfig = _config.withView(view); return (newConfig == _config) ? this : _new(this, newConfig); }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { SerializationConfig newConfig = _config.withView(view); return (newConfig == _config) ? this : new ObjectWriter(this, newConfig); }
/** * Method that will construct a new instance that uses specified * serialization view for serialization (with null basically disables * view processing) *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectWriter withView(Class<?> view) { SerializationConfig newConfig = _config.withView(view); return (newConfig == _config) ? this : _new(this, newConfig); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ public ObjectWriter writerWithView(Class<?> serializationView) { return _newWriter(getSerializationConfig().withView(serializationView)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ @SuppressWarnings("unchecked") public <W extends ObjectWriter> W writerWithView(Class<?> serializationView) { return (W) _newWriter(getSerializationConfig().withView(serializationView)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ public ObjectWriter writerWithView(Class<?> serializationView) { return new ObjectWriter(this, getSerializationConfig().withView(serializationView)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ @SuppressWarnings("unchecked") public <W extends ObjectWriter> W writerWithView(Class<?> serializationView) { return (W) _newWriter(getSerializationConfig().withView(serializationView)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ public ObjectWriter writerWithView(Class<?> serializationView) { return new ObjectWriter(this, getSerializationConfig().withView(serializationView)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). */ public ObjectWriter writerWithView(Class<?> serializationView) { return _newWriter(getSerializationConfig().withView(serializationView)); }
@Inject public JacksonContextResolver(ObjectMapper objectMapper) { this.objectMapper = objectMapper.copy(); this.objectMapper.setConfig(this.objectMapper.getSerializationConfig().withView(RestView.class)); }
@Inject public DefaultWebHookManager(ObjectMapper mapper, ExecutorService executor) { this.mapper = mapper.copy(); this.mapper.setConfig(this.mapper.getSerializationConfig().withView(RestView.class)); this.executor = executor; }
public static ObjectMapper withView(final ObjectMapper mapper, final Class<?> view) { mapper.enable(MapperFeature.DEFAULT_VIEW_INCLUSION); mapper.setConfig(mapper.getSerializationConfig().withView(view)); mapper.setConfig(mapper.getDeserializationConfig().withView(view)); return mapper; }