本文整理匯總了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);