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


Java JsonToken.END_OBJECT属性代码示例

本文整理汇总了Java中android.util.JsonToken.END_OBJECT属性的典型用法代码示例。如果您正苦于以下问题:Java JsonToken.END_OBJECT属性的具体用法?Java JsonToken.END_OBJECT怎么用?Java JsonToken.END_OBJECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.util.JsonToken的用法示例。


在下文中一共展示了JsonToken.END_OBJECT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleSystemOptions

private static boolean handleSystemOptions(Bundle options, String key, JsonReader reader){
    try {
        if (key.equals("entities")) {
            reader.beginObject();
            ArrayList<String> entities = new ArrayList<>();
            while(reader.peek() != JsonToken.END_OBJECT){
                reader.skipValue(); //skip name
                entities.add(reader.nextString());
            }
            reader.endObject();
            options.putStringArrayList(key, entities);
            return true;
        }
    }catch (IOException e){
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:ozodrukh,项目名称:Green,代码行数:18,代码来源:ConfigCard.java

示例2: asMap

public static Bundle asMap(ConfigCard widget, Bundle options, JsonReader reader){
    try {
        reader.beginObject();
        while(reader.peek() != JsonToken.END_OBJECT){
            final String key = reader.nextName();
            if(widget.handleOptions(options, key, reader)){
                continue;
            }

            final JsonToken token = reader.peek();
            if(token == JsonToken.STRING){
                options.putString(key, reader.nextString());
            }else if(token == JsonToken.BOOLEAN){
                options.putBoolean(key, reader.nextBoolean());
            }else if(token == JsonToken.NUMBER){
                options.putInt(key, reader.nextInt());
            }else if(!handleSystemOptions(options, key, reader)){
                reader.skipValue();
            }
        }
        reader.endObject();
    } catch (IOException e) {
        Log.w(TAG, "on >>> " + reader.toString());
        e.printStackTrace();
    }
    return options;
}
 
开发者ID:ozodrukh,项目名称:Green,代码行数:27,代码来源:ConfigCard.java

示例3: parseSplitPath

/**
 * Returns either an {@link AnimatablePathValue} or an {@link AnimatableSplitDimensionPathValue}.
 */
static AnimatableValue<PointF, PointF> parseSplitPath(
    JsonReader reader, LottieComposition composition) throws IOException {

  AnimatablePathValue pathAnimation = null;
  AnimatableFloatValue xAnimation = null;
  AnimatableFloatValue yAnimation = null;

  boolean hasExpressions = false;

  reader.beginObject();
  while (reader.peek() != JsonToken.END_OBJECT) {
    switch (reader.nextName()) {
      case "k":
        pathAnimation = AnimatablePathValueParser.parse(reader, composition);
        break;
      case "x":
        if (reader.peek() == JsonToken.STRING) {
          hasExpressions = true;
          reader.skipValue();
        } else {
          xAnimation = AnimatableValueParser.parseFloat(reader, composition);
        }
        break;
      case "y":
        if (reader.peek() == JsonToken.STRING) {
          hasExpressions = true;
          reader.skipValue();
        } else {
          yAnimation = AnimatableValueParser.parseFloat(reader, composition);
        }
        break;
      default:
        reader.skipValue();
    }
  }
  reader.endObject();

  if (hasExpressions) {
    composition.addWarning("Lottie doesn't support expressions.");
  }

  if (pathAnimation != null) {
    return pathAnimation;
  }
  return new AnimatableSplitDimensionPathValue(xAnimation, yAnimation);
}
 
开发者ID:airbnb,项目名称:lottie-android,代码行数:49,代码来源:AnimatablePathValueParser.java

示例4: parseRecord

private Event parseRecord() throws IOException {
    Long id = null;
    LocalDate date = null;
    LocalTime time = null;
    Integer type = null, subType = null;
    String desc = null;

    reader.beginObject();

    while (reader.hasNext()) {
        if (reader.peek() == JsonToken.END_OBJECT) {
            break;
        }

        switch (reader.nextName()) {
            case "ID":
                id = readID();
                break;
            case "Date":
                date = readDate();
                updateDateRange(date); // sorry for this, but I didn't want to parse date on super, again. :(
                break;
            case "Time":
                time = readTime();
                break;
            case "Type":
                type = readType();
                break;
            case "Title":
                subType = readSubType(type);
                break;
            case "Description":
                desc = readDescription();
                break;
        }

    }

    reader.endObject();
    index++;

    if (null == id) {
        throw new IllegalArgumentException("ID cannot be null");
    } else if (null == date) {
        throw new IllegalArgumentException("Date cannot be null");
    } else if (null == time) {
        throw new IllegalArgumentException("Time cannot be null");
    } else if (null == type) {
        throw new IllegalArgumentException("Type cannot be null");
    } else if (null == subType) {
        throw new IllegalArgumentException("SubType cannot be null");
    } else if (null == desc) {
        throw new IllegalArgumentException("Description cannot be null");
    }

    return new Event(id, date, time, type, subType, desc);
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:57,代码来源:RestoreDialog.java


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