本文整理匯總了Java中org.codehaus.jackson.JsonToken.VALUE_EMBEDDED_OBJECT屬性的典型用法代碼示例。如果您正苦於以下問題:Java JsonToken.VALUE_EMBEDDED_OBJECT屬性的具體用法?Java JsonToken.VALUE_EMBEDDED_OBJECT怎麽用?Java JsonToken.VALUE_EMBEDDED_OBJECT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.codehaus.jackson.JsonToken
的用法示例。
在下文中一共展示了JsonToken.VALUE_EMBEDDED_OBJECT屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deserialize
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: getBinaryValue
public byte[] getBinaryValue(Base64Variant paramBase64Variant)
throws IOException, JsonParseException
{
if (this._currToken == JsonToken.VALUE_EMBEDDED_OBJECT)
{
Object localObject = _currentObject();
if ((localObject instanceof byte[]))
return (byte[])(byte[])localObject;
}
if (this._currToken != JsonToken.VALUE_STRING)
throw _constructError("Current token (" + this._currToken + ") not VALUE_STRING (or VALUE_EMBEDDED_OBJECT with byte[]), can not access as binary");
String str = getText();
if (str == null)
return null;
ByteArrayBuilder localByteArrayBuilder = this._byteBuilder;
if (localByteArrayBuilder == null)
{
localByteArrayBuilder = new ByteArrayBuilder(100);
this._byteBuilder = localByteArrayBuilder;
}
_decodeBase64(str, localByteArrayBuilder, paramBase64Variant);
return localByteArrayBuilder.toByteArray();
}
示例3: getBinaryValue
public byte[] getBinaryValue(Base64Variant paramBase64Variant)
throws IOException, JsonParseException
{
if ((this._currToken != JsonToken.VALUE_STRING) && ((this._currToken != JsonToken.VALUE_EMBEDDED_OBJECT) || (this._binaryValue == null)))
_reportError("Current token (" + this._currToken + ") not VALUE_STRING or VALUE_EMBEDDED_OBJECT, can not access as binary");
if (this._tokenIncomplete);
try
{
this._binaryValue = _decodeBase64(paramBase64Variant);
this._tokenIncomplete = false;
return this._binaryValue;
}
catch (IllegalArgumentException localIllegalArgumentException)
{
}
throw _constructError("Failed to decode VALUE_STRING as base64 (" + paramBase64Variant + "): " + localIllegalArgumentException.getMessage());
}
示例4: deserialize
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;
}
}
}
示例5: deserialize
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);
}
示例6: getEmbeddedObject
public Object getEmbeddedObject()
{
if (this._currToken == JsonToken.VALUE_EMBEDDED_OBJECT)
return _currentObject();
return null;
}
示例7: asToken
public JsonToken asToken()
{
return JsonToken.VALUE_EMBEDDED_OBJECT;
}