本文整理汇总了Java中com.fasterxml.jackson.databind.util.TokenBuffer.writeString方法的典型用法代码示例。如果您正苦于以下问题:Java TokenBuffer.writeString方法的具体用法?Java TokenBuffer.writeString怎么用?Java TokenBuffer.writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.util.TokenBuffer
的用法示例。
在下文中一共展示了TokenBuffer.writeString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
private final Object _deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
boolean bool = paramJsonParser.isExpectedStartArrayToken();
String str = _locateTypeId(paramJsonParser, paramDeserializationContext);
JsonDeserializer localJsonDeserializer = _findDeserializer(paramDeserializationContext, str);
if ((this._typeIdVisible) && (paramJsonParser.getCurrentToken() == JsonToken.START_OBJECT))
{
TokenBuffer localTokenBuffer = new TokenBuffer(null);
localTokenBuffer.writeStartObject();
localTokenBuffer.writeFieldName(this._typePropertyName);
localTokenBuffer.writeString(str);
JsonParserSequence localJsonParserSequence = JsonParserSequence.createFlattened(localTokenBuffer.asParser(paramJsonParser), paramJsonParser);
paramJsonParser = localJsonParserSequence;
localJsonParserSequence.nextToken();
}
Object localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
if ((bool) && (paramJsonParser.nextToken() != JsonToken.END_ARRAY))
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.END_ARRAY, "expected closing END_ARRAY after type information and deserialized value");
return localObject;
}
示例2: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
private final Object _deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
if (paramJsonParser.getCurrentToken() != JsonToken.START_OBJECT)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.START_OBJECT, "need JSON Object to contain As.WRAPPER_OBJECT type information for class " + baseTypeName());
if (paramJsonParser.nextToken() != JsonToken.FIELD_NAME)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.FIELD_NAME, "need JSON String that contains type id (for subtype of " + baseTypeName() + ")");
String str = paramJsonParser.getText();
JsonDeserializer localJsonDeserializer = _findDeserializer(paramDeserializationContext, str);
paramJsonParser.nextToken();
if ((this._typeIdVisible) && (paramJsonParser.getCurrentToken() == JsonToken.START_OBJECT))
{
TokenBuffer localTokenBuffer = new TokenBuffer(null);
localTokenBuffer.writeStartObject();
localTokenBuffer.writeFieldName(this._typePropertyName);
localTokenBuffer.writeString(str);
JsonParserSequence localJsonParserSequence = JsonParserSequence.createFlattened(localTokenBuffer.asParser(paramJsonParser), paramJsonParser);
paramJsonParser = localJsonParserSequence;
localJsonParserSequence.nextToken();
}
Object localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
if (paramJsonParser.nextToken() != JsonToken.END_OBJECT)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.END_OBJECT, "expected closing END_OBJECT after type information and deserialized value");
return localObject;
}
示例3: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
/**
* Method that handles type information wrapper, locates actual
* subtype deserializer to use, and calls it to do actual
* deserialization.
*/
private final Object _deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
boolean hadStartArray = jp.isExpectedStartArrayToken();
String typeId = _locateTypeId(jp, ctxt);
JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId);
// Minor complication: we may need to merge type id in?
if (_typeIdVisible && jp.getCurrentToken() == JsonToken.START_OBJECT) {
// but what if there's nowhere to add it in? Error? Or skip? For now, skip.
TokenBuffer tb = new TokenBuffer(null);
tb.writeStartObject(); // recreate START_OBJECT
tb.writeFieldName(_typePropertyName);
tb.writeString(typeId);
jp = JsonParserSequence.createFlattened(tb.asParser(jp), jp);
jp.nextToken();
}
Object value = deser.deserialize(jp, ctxt);
// And then need the closing END_ARRAY
if (hadStartArray && jp.nextToken() != JsonToken.END_ARRAY) {
throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY,
"expected closing END_ARRAY after type information and deserialized value");
}
return value;
}
示例4: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
protected final Object _deserialize(JsonParser jp, DeserializationContext ctxt,
int index)
throws IOException, JsonProcessingException
{
TokenBuffer merged = new TokenBuffer(jp.getCodec());
merged.writeStartArray();
merged.writeString(_typeIds[index]);
JsonParser p2 = _tokens[index].asParser(jp);
p2.nextToken();
merged.copyCurrentStructure(p2);
merged.writeEndArray();
// needs to point to START_OBJECT (or whatever first token is)
p2 = merged.asParser(jp);
p2.nextToken();
return _properties[index].getProperty().deserialize(p2, ctxt);
}
示例5: _deserializeAndSet
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
protected final void _deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object bean, int index)
throws IOException, JsonProcessingException
{
/* Ok: time to mix type id, value; and we will actually use "wrapper-array"
* style to ensure we can handle all kinds of JSON constructs.
*/
TokenBuffer merged = new TokenBuffer(jp.getCodec());
merged.writeStartArray();
merged.writeString(_typeIds[index]);
JsonParser p2 = _tokens[index].asParser(jp);
p2.nextToken();
merged.copyCurrentStructure(p2);
merged.writeEndArray();
// needs to point to START_OBJECT (or whatever first token is)
p2 = merged.asParser(jp);
p2.nextToken();
_properties[index].getProperty().deserializeAndSet(p2, ctxt, bean);
}
示例6: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
protected final Object _deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, int paramInt, String paramString)
{
TokenBuffer localTokenBuffer = new TokenBuffer(paramJsonParser.getCodec());
localTokenBuffer.writeStartArray();
localTokenBuffer.writeString(paramString);
JsonParser localJsonParser1 = this._tokens[paramInt].asParser(paramJsonParser);
localJsonParser1.nextToken();
localTokenBuffer.copyCurrentStructure(localJsonParser1);
localTokenBuffer.writeEndArray();
JsonParser localJsonParser2 = localTokenBuffer.asParser(paramJsonParser);
localJsonParser2.nextToken();
return this._properties[paramInt].getProperty().deserialize(localJsonParser2, paramDeserializationContext);
}
示例7: _deserializeAndSet
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
protected final void _deserializeAndSet(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Object paramObject, int paramInt, String paramString)
{
TokenBuffer localTokenBuffer = new TokenBuffer(paramJsonParser.getCodec());
localTokenBuffer.writeStartArray();
localTokenBuffer.writeString(paramString);
JsonParser localJsonParser1 = this._tokens[paramInt].asParser(paramJsonParser);
localJsonParser1.nextToken();
localTokenBuffer.copyCurrentStructure(localJsonParser1);
localTokenBuffer.writeEndArray();
JsonParser localJsonParser2 = localTokenBuffer.asParser(paramJsonParser);
localJsonParser2.nextToken();
this._properties[paramInt].getProperty().deserializeAndSet(localJsonParser2, paramDeserializationContext, paramObject);
}
示例8: _deserialize
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
/**
* Method that handles type information wrapper, locates actual
* subtype deserializer to use, and calls it to do actual
* deserialization.
*/
private final Object _deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
// first, sanity checks
if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
throw ctxt.wrongTokenException(jp, JsonToken.START_OBJECT,
"need JSON Object to contain As.WRAPPER_OBJECT type information for class "+baseTypeName());
}
// should always get field name, but just in case...
if (jp.nextToken() != JsonToken.FIELD_NAME) {
throw ctxt.wrongTokenException(jp, JsonToken.FIELD_NAME,
"need JSON String that contains type id (for subtype of "+baseTypeName()+")");
}
final String typeId = jp.getText();
JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId);
jp.nextToken();
// Minor complication: we may need to merge type id in?
if (_typeIdVisible && jp.getCurrentToken() == JsonToken.START_OBJECT) {
// but what if there's nowhere to add it in? Error? Or skip? For now, skip.
TokenBuffer tb = new TokenBuffer(null);
tb.writeStartObject(); // recreate START_OBJECT
tb.writeFieldName(_typePropertyName);
tb.writeString(typeId);
jp = JsonParserSequence.createFlattened(tb.asParser(jp), jp);
jp.nextToken();
}
Object value = deser.deserialize(jp, ctxt);
// And then need the closing END_OBJECT
if (jp.nextToken() != JsonToken.END_OBJECT) {
throw ctxt.wrongTokenException(jp, JsonToken.END_OBJECT,
"expected closing END_OBJECT after type information and deserialized value");
}
return value;
}
示例9: deserializeTypedFromObject
import com.fasterxml.jackson.databind.util.TokenBuffer; //导入方法依赖的package包/类
@Override
public Object deserializeTypedFromObject(JsonParser p, DeserializationContext ctxt) throws IOException {
JsonToken t;
t = p.getCurrentToken();
if (t == JsonToken.START_OBJECT) {
t = p.nextToken();
} else if (t != JsonToken.FIELD_NAME) {
throw new JsonMappingException(p, "Could not extract event type from non-object");
}
final TokenBuffer tb = new TokenBuffer(p, ctxt);
for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) {
final String topLevelProperty = p.getCurrentName();
tb.writeFieldName(topLevelProperty);
t = p.nextToken();
if (topLevelProperty.equals("metadata")) {
if (t != JsonToken.START_OBJECT) {
throw new JsonMappingException(p, "Could not extract event type from invalid metadata");
}
tb.writeStartObject();
t = p.nextToken();
for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) {
final String metadataProperty = p.getCurrentName();
tb.writeFieldName(metadataProperty);
t = p.nextToken();
if (metadataProperty.equals("event_type")) {
if (t != JsonToken.VALUE_STRING) {
throw new JsonMappingException(p, "Could not extract event type from non-string property");
}
final String typeId = p.getText();
tb.writeString(typeId);
final JsonParser pb = JsonParserSequence.createFlattened(false, tb.asParser(p), p);
return deserialize(pb, ctxt, typeId);
} else {
tb.copyCurrentStructure(p);
}
}
} else {
tb.copyCurrentStructure(p);
}
}
throw new JsonMappingException(p, "Could not find metadata property to extract event type");
}