本文整理汇总了Java中com.fasterxml.jackson.databind.ser.impl.WritableObjectId类的典型用法代码示例。如果您正苦于以下问题:Java WritableObjectId类的具体用法?Java WritableObjectId怎么用?Java WritableObjectId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WritableObjectId类属于com.fasterxml.jackson.databind.ser.impl包,在下文中一共展示了WritableObjectId类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _serializeWithObjectId
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; //导入依赖的package包/类
public final void _serializeWithObjectId(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, boolean paramBoolean)
{
ObjectIdWriter localObjectIdWriter = this._objectIdWriter;
WritableObjectId localWritableObjectId = paramSerializerProvider.findObjectId(paramObject, localObjectIdWriter.generator);
if (localWritableObjectId.writeAsId(paramJsonGenerator, paramSerializerProvider, localObjectIdWriter))
return;
Object localObject = localWritableObjectId.generateId(paramObject);
if (localObjectIdWriter.alwaysAsId)
{
localObjectIdWriter.serializer.serialize(localObject, paramJsonGenerator, paramSerializerProvider);
return;
}
if (paramBoolean)
paramJsonGenerator.writeStartObject();
localWritableObjectId.writeAsField(paramJsonGenerator, paramSerializerProvider, localObjectIdWriter);
if (this._propertyFilterId != null)
serializeFieldsFiltered(paramObject, paramJsonGenerator, paramSerializerProvider);
else
serializeFields(paramObject, paramJsonGenerator, paramSerializerProvider);
if (paramBoolean)
paramJsonGenerator.writeEndObject();
}
示例2: serializeWithObjectId
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; //导入依赖的package包/类
private final void serializeWithObjectId(Object bean,
JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
final ObjectIdWriter w = _objectIdWriter;
WritableObjectId oid = provider.findObjectId(bean, w.generator);
Object id = oid.id;
if (id != null) { // have seen before; serialize just id
oid.serializer.serialize(id, jgen, provider);
return;
}
// if not, bit more work:
oid.serializer = w.serializer;
oid.id = id = oid.generator.generateId(bean);
// possibly. Or maybe not:
if (w.alwaysAsId) {
oid.serializer.serialize(id, jgen, provider);
return;
}
// If not, need to inject the id:
jgen.writeStartObject();
SerializedString name = w.propertyName;
if (name != null) {
jgen.writeFieldName(name);
w.serializer.serialize(id, jgen, provider);
}
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, jgen, provider);
} else {
serializeFields(bean, jgen, provider);
}
jgen.writeEndObject();
}
示例3: findObjectId
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; //导入依赖的package包/类
public WritableObjectId findObjectId(Object paramObject, ObjectIdGenerator<?> paramObjectIdGenerator)
{
if (this._seenObjectIds == null)
{
this._seenObjectIds = new IdentityHashMap();
}
else
{
WritableObjectId localWritableObjectId1 = (WritableObjectId)this._seenObjectIds.get(paramObject);
if (localWritableObjectId1 != null)
return localWritableObjectId1;
}
Object localObject;
if (this._objectIdGenerators == null)
{
this._objectIdGenerators = new ArrayList(8);
localObject = null;
}
else
{
int i = 0;
int j = this._objectIdGenerators.size();
while (true)
{
localObject = null;
if (i >= j)
break;
ObjectIdGenerator localObjectIdGenerator = (ObjectIdGenerator)this._objectIdGenerators.get(i);
if (localObjectIdGenerator.canUseFor(paramObjectIdGenerator))
{
localObject = localObjectIdGenerator;
break;
}
i++;
}
}
if (localObject == null)
{
localObject = paramObjectIdGenerator.newForSerialization(this);
this._objectIdGenerators.add(localObject);
}
WritableObjectId localWritableObjectId2 = new WritableObjectId((ObjectIdGenerator)localObject);
this._seenObjectIds.put(paramObject, localWritableObjectId2);
return localWritableObjectId2;
}
示例4: _serializeWithObjectId
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; //导入依赖的package包/类
private final void _serializeWithObjectId(Object bean,
JsonGenerator jgen, SerializerProvider provider,
TypeSerializer typeSer)
throws IOException, JsonGenerationException
{
final ObjectIdWriter w = _objectIdWriter;
WritableObjectId oid = provider.findObjectId(bean, w.generator);
Object id = oid.id;
if (id != null) { // have seen before; serialize just id
oid.serializer.serialize(id, jgen, provider);
return;
}
// if not, bit more work:
oid.serializer = w.serializer;
oid.id = id = oid.generator.generateId(bean);
String typeStr = (_typeId == null) ? null :_customTypeId(bean);
if (typeStr == null) {
typeSer.writeTypePrefixForObject(bean, jgen);
} else {
typeSer.writeCustomTypePrefixForObject(bean, jgen, typeStr);
}
// Very first thing: inject the id property
SerializedString name = w.propertyName;
if (name != null) {
jgen.writeFieldName(name);
w.serializer.serialize(id, jgen, provider);
}
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, jgen, provider);
} else {
serializeFields(bean, jgen, provider);
}
if (typeStr == null) {
typeSer.writeTypeSuffixForObject(bean, jgen);
} else {
typeSer.writeCustomTypeSuffixForObject(bean, jgen, typeStr);
}
}
示例5: findObjectId
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; //导入依赖的package包/类
public abstract WritableObjectId findObjectId(Object paramObject, ObjectIdGenerator<?> paramObjectIdGenerator);