com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter Java Examples

The following examples show how to use com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter. 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 Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected final void _serializeWithObjectId(Object bean, JsonGenerator gen, SerializerProvider provider,
        TypeSerializer typeSer) throws IOException
{
    final ObjectIdWriter w = _objectIdWriter;
    WritableObjectId objectId = provider.findObjectId(bean, w.generator);
    // If possible, write as id already
    if (objectId.writeAsId(gen, provider, w)) {
        return;
    }
    // If not, need to inject the id:
    Object id = objectId.generateId(bean);
    if (w.alwaysAsId) {
        w.serializer.serialize(id, gen, provider);
        return;
    }
    _serializeObjectId(bean, gen, provider, typeSer, objectId);
}
 
Example #2
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected  void _serializeObjectId(Object bean, JsonGenerator g,
        SerializerProvider provider,
        TypeSerializer typeSer, WritableObjectId objectId) throws IOException
{
    final ObjectIdWriter w = _objectIdWriter;
    WritableTypeId typeIdDef = _typeIdDef(typeSer, bean, JsonToken.START_OBJECT);

    typeSer.writeTypePrefix(g, typeIdDef);
    objectId.writeAsField(g, provider, w);
    if (_propertyFilterId != null) {
        serializeFieldsFiltered(bean, g, provider);
    } else {
        serializeFields(bean, g, provider);
    }
    typeSer.writeTypeSuffix(g, typeIdDef);
}
 
Example #3
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
protected BeanSerializerBase(BeanSerializerBase src,
        ObjectIdWriter objectIdWriter, Object filterId)
{
    super(src._handledType);
    _beanType = src._beanType;
    _props = src._props;
    _filteredProps = src._filteredProps;
    
    _typeId = src._typeId;
    _anyGetterWriter = src._anyGetterWriter;
    _objectIdWriter = objectIdWriter;
    _propertyFilterId = filterId;
    _serializationShape = src._serializationShape;
}
 
Example #4
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected final void _serializeWithObjectId(Object bean, JsonGenerator gen, SerializerProvider provider,
        boolean startEndObject) throws IOException
{
    final ObjectIdWriter w = _objectIdWriter;
    WritableObjectId objectId = provider.findObjectId(bean, w.generator);
    // If possible, write as id already
    if (objectId.writeAsId(gen, provider, w)) {
        return;
    }
    // If not, need to inject the id:
    Object id = objectId.generateId(bean);
    if (w.alwaysAsId) {
        w.serializer.serialize(id, gen, provider);
        return;
    }
    if (startEndObject) {
        gen.writeStartObject(bean);
    }
    objectId.writeAsField(gen, provider, w);
    if (_propertyFilterId != null) {
        serializeFieldsFiltered(bean, gen, provider);
    } else {
        serializeFields(bean, gen, provider);
    }
    if (startEndObject) {
        gen.writeEndObject();
    }
}
 
Example #5
Source Project: albedo   Author: somowhere   File: ExtraFieldSerializer.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public ExtraFieldSerializer(ExtraFieldSerializer source,
							ObjectIdWriter objectIdWriter) {
	super(source, objectIdWriter);
}
 
Example #6
Source Project: albedo   Author: somowhere   File: ExtraFieldSerializer.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public ExtraFieldSerializer(ExtraFieldSerializer source,
							ObjectIdWriter objectIdWriter, Object filterId) {
	super(source, objectIdWriter, filterId);
}
 
Example #7
Source Project: albedo   Author: somowhere   File: ExtraFieldSerializer.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BeanSerializerBase withObjectIdWriter(
	ObjectIdWriter objectIdWriter) {
	return new ExtraFieldSerializer(this, objectIdWriter);
}
 
Example #8
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBuilder.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void setObjectIdWriter(ObjectIdWriter w) {
    _objectIdWriter = w;
}
 
Example #9
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BeanSerializerBase(BeanSerializerBase src,
        ObjectIdWriter objectIdWriter)
{
    this(src, objectIdWriter, src._propertyFilterId);
}
 
Example #10
Source Project: lams   Author: lamsfoundation   File: BeanSerializer.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BeanSerializer(BeanSerializerBase src,
        ObjectIdWriter objectIdWriter) {
    super(src, objectIdWriter);
}
 
Example #11
Source Project: lams   Author: lamsfoundation   File: BeanSerializer.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BeanSerializer(BeanSerializerBase src,
        ObjectIdWriter objectIdWriter, Object filterId) {
    super(src, objectIdWriter, filterId);
}
 
Example #12
Source Project: lams   Author: lamsfoundation   File: BeanSerializer.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
    return new BeanSerializer(this, objectIdWriter, _propertyFilterId);
}
 
Example #13
Source Project: caravan   Author: ctripcorp   File: AbstractBeanSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
  return this;
}
 
Example #14
Source Project: datacollector   Author: streamsets   File: FlatRBeanSerializerModifier.java    License: Apache License 2.0 4 votes vote down vote up
RBeanContextData(RBeanContextData source, ObjectIdWriter objectIdWriter) {
  super(source, objectIdWriter);
}
 
Example #15
Source Project: datacollector   Author: streamsets   File: FlatRBeanSerializerModifier.java    License: Apache License 2.0 4 votes vote down vote up
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
  return new RBeanContextData(this, objectIdWriter);
}
 
Example #16
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBase.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Mutant factory used for creating a new instance with different
 * {@link ObjectIdWriter}.
 * 
 * @since 2.0
 */
public abstract BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter);
 
Example #17
Source Project: lams   Author: lamsfoundation   File: BeanSerializerBuilder.java    License: GNU General Public License v2.0 votes vote down vote up
public ObjectIdWriter getObjectIdWriter() { return _objectIdWriter; }