本文整理汇总了Java中org.codehaus.jackson.JsonParser.getEmbeddedObject方法的典型用法代码示例。如果您正苦于以下问题:Java JsonParser.getEmbeddedObject方法的具体用法?Java JsonParser.getEmbeddedObject怎么用?Java JsonParser.getEmbeddedObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.JsonParser
的用法示例。
在下文中一共展示了JsonParser.getEmbeddedObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
public String deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_STRING)
return paramJsonParser.getText();
if (localJsonToken == JsonToken.VALUE_EMBEDDED_OBJECT)
{
Object localObject = paramJsonParser.getEmbeddedObject();
if (localObject == null)
return null;
if ((localObject instanceof byte[]))
return Base64Variants.getDefaultVariant().encode((byte[])(byte[])localObject, false);
return localObject.toString();
}
if (localJsonToken.isScalarValue())
return paramJsonParser.getText();
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例2: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
public final T deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
String str;
Object localObject2;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING)
{
str = paramJsonParser.getText().trim();
int i = str.length();
localObject2 = null;
if (i != 0);
}
while (true)
{
return localObject2;
try
{
Object localObject3 = _deserialize(str, paramDeserializationContext);
localObject2 = localObject3;
if (localObject2 != null)
continue;
label55: throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid textual representation");
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_EMBEDDED_OBJECT)
{
Object localObject1 = paramJsonParser.getEmbeddedObject();
localObject2 = null;
if (localObject1 == null)
continue;
if (this._valueClass.isAssignableFrom(localObject1.getClass()))
return localObject1;
return _deserializeEmbedded(localObject1, paramDeserializationContext);
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
break label55;
}
}
}
示例3: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
public byte[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
if (localJsonToken1 == JsonToken.VALUE_STRING)
return paramJsonParser.getBinaryValue(paramDeserializationContext.getBase64Variant());
if (localJsonToken1 == JsonToken.VALUE_EMBEDDED_OBJECT)
{
Object localObject = paramJsonParser.getEmbeddedObject();
if (localObject == null)
return null;
if ((localObject instanceof byte[]))
return (byte[])(byte[])localObject;
}
if (!paramJsonParser.isExpectedStartArrayToken())
return handleNonArray(paramJsonParser, paramDeserializationContext);
ArrayBuilders.ByteBuilder localByteBuilder = paramDeserializationContext.getArrayBuilders().getByteBuilder();
byte[] arrayOfByte = (byte[])localByteBuilder.resetAndStart();
int i = 0;
JsonToken localJsonToken2 = paramJsonParser.nextToken();
if (localJsonToken2 != JsonToken.END_ARRAY)
{
if ((localJsonToken2 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken2 == JsonToken.VALUE_NUMBER_FLOAT));
for (int j = paramJsonParser.getByteValue(); ; j = 0)
{
if (i >= arrayOfByte.length)
{
arrayOfByte = (byte[])localByteBuilder.appendCompletedChunk(arrayOfByte, i);
i = 0;
}
int k = i + 1;
arrayOfByte[i] = j;
i = k;
break;
if (localJsonToken2 == JsonToken.VALUE_NULL)
continue;
throw paramDeserializationContext.mappingException(this._valueClass.getComponentType());
}
}
return (byte[])localByteBuilder.completeAndClearBuffer(arrayOfByte, i);
}