当前位置: 首页>>代码示例>>Java>>正文


Java JsonToken.VALUE_EMBEDDED_OBJECT属性代码示例

本文整理汇总了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);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:19,代码来源:StdDeserializer.java

示例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();
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:23,代码来源:TokenBuffer.java

示例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());
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:17,代码来源:ReaderBasedParser.java

示例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;
    }
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:40,代码来源:FromStringDeserializer.java

示例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);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:41,代码来源:ArrayDeserializers.java

示例6: getEmbeddedObject

public Object getEmbeddedObject()
{
  if (this._currToken == JsonToken.VALUE_EMBEDDED_OBJECT)
    return _currentObject();
  return null;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:6,代码来源:TokenBuffer.java

示例7: asToken

public JsonToken asToken()
{
  return JsonToken.VALUE_EMBEDDED_OBJECT;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:4,代码来源:POJONode.java


注:本文中的org.codehaus.jackson.JsonToken.VALUE_EMBEDDED_OBJECT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。