Example usage for com.google.gson JsonElement getAsInt

List of usage examples for com.google.gson JsonElement getAsInt

Introduction

In this page you can find the example usage for com.google.gson JsonElement getAsInt.

Prototype

public int getAsInt() 

Source Link

Document

convenience method to get this element as a primitive integer value.

Usage

From source file:org.tuleap.mylyn.task.core.internal.parser.AbstractDetailedElementDeserializer.java

License:Open Source License

/**
 * {@inheritDoc}/*from  w w  w . ja  va2  s  .  c o  m*/
 *
 * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type,
 *      com.google.gson.JsonDeserializationContext)
 */
@Override
public T deserialize(JsonElement rootJsonElement, Type type, JsonDeserializationContext context)
        throws JsonParseException {

    T pojo = super.deserialize(rootJsonElement, type, context);

    JsonObject jsonObject = rootJsonElement.getAsJsonObject();

    JsonElement element = jsonObject.get(HTML_URL);
    if (element != null && !element.isJsonNull()) {
        String htmlUrl = element.getAsString();
        pojo.setHtmlUrl(htmlUrl);
    }
    element = jsonObject.get(SUBMITTED_ON);
    if (element != null && !element.isJsonNull()) {
        try {
            pojo.setSubmittedOn(context.<Date>deserialize(element, Date.class));
        } catch (JsonParseException e) {
            TuleapCoreActivator.log(e, false);
        }
    }
    element = jsonObject.get(SUBMITTED_BY);
    if (element != null && element.isJsonPrimitive()) {
        int submittedBy = element.getAsInt();
        pojo.setSubmittedBy(submittedBy);
    }
    element = jsonObject.get(LAST_MODIFIED_DATE);
    if (element != null && !element.isJsonNull()) {
        try {
            pojo.setLastModifiedDate(context.<Date>deserialize(element, Date.class));
        } catch (JsonParseException e) {
            TuleapCoreActivator.log(e, false);
        }
    }
    return pojo;
}

From source file:org.tuleap.mylyn.task.core.internal.parser.AbstractTuleapDeserializer.java

License:Open Source License

/**
 * {@inheritDoc}/* w  w w .j  a  v  a2 s  .co m*/
 *
 * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type,
 *      com.google.gson.JsonDeserializationContext)
 */
@Override
public T deserialize(JsonElement rootJsonElement, Type type, JsonDeserializationContext context)
        throws JsonParseException {
    JsonObject jsonObject = rootJsonElement.getAsJsonObject();
    T pojo = super.deserialize(rootJsonElement, type, context);
    JsonElement jsonTrackerRef = jsonObject.get(ITuleapConstants.JSON_TRACKER);
    TuleapReference trackerRef = context.deserialize(jsonTrackerRef, TuleapReference.class);
    pojo.setTracker(trackerRef);

    JsonArray fields = jsonObject.get(ITuleapConstants.VALUES).getAsJsonArray();
    for (JsonElement field : fields) {
        JsonObject jsonField = field.getAsJsonObject();
        int fieldId = jsonField.get(ITuleapConstants.FIELD_ID).getAsInt();
        if (jsonField.has(ITuleapConstants.FIELD_VALUE)) {
            JsonElement jsonValue = jsonField.get(ITuleapConstants.FIELD_VALUE);
            if (jsonValue.isJsonPrimitive()) {
                JsonPrimitive primitive = jsonValue.getAsJsonPrimitive();
                if (primitive.isString()) {
                    pojo.addFieldValue(new LiteralFieldValue(fieldId, primitive.getAsString()));
                } else if (primitive.isNumber()) {
                    pojo.addFieldValue(new LiteralFieldValue(fieldId, String.valueOf(primitive.getAsNumber())));
                } else if (primitive.isBoolean()) {
                    pojo.addFieldValue(
                            new LiteralFieldValue(fieldId, String.valueOf(primitive.getAsBoolean())));
                }
            }
        } else if (jsonField.has(ITuleapConstants.FIELD_BIND_VALUE_ID)
                && !jsonField.get(ITuleapConstants.FIELD_BIND_VALUE_ID).isJsonNull()) {
            // sb?
            JsonElement jsonBindValueId = jsonField.get(ITuleapConstants.FIELD_BIND_VALUE_ID);
            int bindValueId = jsonBindValueId.getAsInt();
            pojo.addFieldValue(new BoundFieldValue(fieldId, Lists.newArrayList(Integer.valueOf(bindValueId))));
        } else if (jsonField.has(ITuleapConstants.FIELD_BIND_VALUE_IDS)
                && !jsonField.get(ITuleapConstants.FIELD_BIND_VALUE_IDS).isJsonNull()) {
            // sb?, msb, cb, or tbl (open list)
            JsonElement jsonBindValueIds = jsonField.get(ITuleapConstants.FIELD_BIND_VALUE_IDS);
            JsonArray jsonIds = jsonBindValueIds.getAsJsonArray();
            if (jsonIds.size() > 0) {
                JsonPrimitive firstElement = jsonIds.get(0).getAsJsonPrimitive();
                if (firstElement.isString()) {
                    // Open list (tbl)
                    List<String> bindValueIds = new ArrayList<String>();
                    for (JsonElement idElement : jsonIds) {
                        bindValueIds.add(idElement.getAsString());
                    }
                    pojo.addFieldValue(new OpenListFieldValue(fieldId, bindValueIds));
                } else {
                    List<Integer> bindValueIds = new ArrayList<Integer>();
                    for (JsonElement idElement : jsonIds) {
                        bindValueIds.add(Integer.valueOf(idElement.getAsInt()));
                    }
                    pojo.addFieldValue(new BoundFieldValue(fieldId, bindValueIds));
                }
            } else {
                pojo.addFieldValue(new BoundFieldValue(fieldId, Collections.<Integer>emptyList()));
            }
        } else if (jsonField.has(ITuleapConstants.FIELD_LINKS)
                && !jsonField.get(ITuleapConstants.FIELD_LINKS).isJsonNull()) {
            // Artifact links
            pojo.addFieldValue(
                    context.<ArtifactLinkFieldValue>deserialize(jsonField, ArtifactLinkFieldValue.class));
        } else if (jsonField.has(ITuleapConstants.FILE_DESCRIPTIONS)
                && jsonField.get(ITuleapConstants.FILE_DESCRIPTIONS).isJsonArray()) {
            AttachmentFieldValue value = context.deserialize(jsonField, AttachmentFieldValue.class);
            pojo.addFieldValue(value);
        }

    }

    return pojo;
}

From source file:org.tuleap.mylyn.task.core.internal.parser.TuleapChangesetDeserializer.java

License:Open Source License

/**
 * Deserialize the JSON representation of a comment.
 *
 * @param element//  www. java  2  s  .c om
 *            The JSON comment
 * @param type
 *            The comment type
 * @param context
 *            The context
 * @return the TuleapElementComment
 * @throws JsonParseException
 *             The exception to throw
 */
@Override
public TuleapElementComment deserialize(JsonElement element, Type type, JsonDeserializationContext context)
        throws JsonParseException {

    JsonObject jsonObject = element.getAsJsonObject();

    Date submissionDate = null;
    int submittedBy = -1;
    String email = null;
    String body = null;

    JsonElement theElement = jsonObject.get(SUBMITTED_ON);
    if (theElement != null && !theElement.isJsonNull()) {
        try {
            submissionDate = context.<Date>deserialize(theElement, Date.class);
        } catch (JsonParseException e) {
            TuleapCoreActivator.log(e, false);
        }
    }

    theElement = jsonObject.get(SUBMITTED_BY);
    if (theElement != null && theElement.isJsonPrimitive()) {
        submittedBy = theElement.getAsInt();
    }

    theElement = jsonObject.get(EMAIL);
    if (theElement != null && theElement.isJsonPrimitive()) {
        email = theElement.getAsString();
    }

    JsonObject lastComment = jsonObject.get(LAST_COMMENT).getAsJsonObject();

    theElement = lastComment.get(BODY);
    if (theElement != null && theElement.isJsonPrimitive()) {
        body = theElement.getAsString();
    }

    TuleapUser user = new TuleapUser(null, null, submittedBy, email, null);

    return new TuleapElementComment(body, user, submissionDate);

}

From source file:org.tuleap.mylyn.task.core.internal.parser.TuleapWorkflowTransitionDeserializer.java

License:Open Source License

/**
 * {@inheritDoc}/*  w  ww  . j  a  v  a 2 s  .  c om*/
 *
 * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type,
 *      com.google.gson.JsonDeserializationContext)
 */
@Override
public TuleapWorkflowTransition deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
        throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    JsonElement fromElement = jsonObject.get(FROM_FIELD_VALUE_ID);
    // By default, the initial state is unselected
    int from = ITuleapConstants.CONFIGURABLE_FIELD_NONE_BINDING_ID;
    if (fromElement != null && !fromElement.isJsonNull()) {
        from = fromElement.getAsInt();
    }
    int to = jsonObject.get(TO_FIELD_VALUE_ID).getAsInt();

    TuleapWorkflowTransition transition = new TuleapWorkflowTransition();
    transition.setFrom(from);
    transition.setTo(to);
    return transition;
}

From source file:org.tuleap.mylyn.task.core.internal.serializer.ArtifactLinkFieldValueAdapter.java

License:Open Source License

/**
 * {@inheritDoc}/* ww  w  .j  a va  2  s  .  c o m*/
 *
 * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type,
 *      com.google.gson.JsonDeserializationContext)
 */
@Override
public ArtifactLinkFieldValue deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
        throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    JsonElement idElem = jsonObject.get(ITuleapConstants.FIELD_ID);
    JsonElement linksElem = jsonObject.get(ITuleapConstants.FIELD_LINKS);
    int fieldId = idElem.getAsInt();
    int[] values;
    if (linksElem != null && linksElem.isJsonArray()) {
        JsonArray array = linksElem.getAsJsonArray();
        values = new int[array.size()];
        int i = 0;
        for (JsonElement elem : array) {
            values[i++] = elem.getAsJsonObject().get(ITuleapConstants.ID).getAsInt();
        }
    } else {
        values = new int[0];
    }
    ArtifactLinkFieldValue result = new ArtifactLinkFieldValue(fieldId, values);
    return result;
}

From source file:org.uorm.serializer.DefaultJsonSerializer.java

License:Apache License

@Override
public Map<String, Object> deserialize2(Class<?> cls, String json) throws Exception {
    JsonStreamParser parser = new JsonStreamParser(json);
    if (parser.hasNext()) {
        JsonObject jsonobj = parser.next().getAsJsonObject();
        Set<Entry<String, JsonElement>> jset = jsonobj.entrySet();
        if (!jset.isEmpty()) {
            Map<String, PropertyDescriptor> propMap = ObjectMappingCache.getInstance()
                    .getObjectPropertyMap(cls);
            Map<String, Object> instance = new HashMap<String, Object>();
            for (Entry<String, JsonElement> entry : jset) {
                String name = entry.getKey();
                JsonElement val = entry.getValue();
                if (!val.isJsonNull()) {
                    PropertyDescriptor descriptor = propMap.get(name);
                    if (descriptor != null) {
                        Class<?> memberType = descriptor.getPropertyType();
                        if (memberType == String.class) {
                            instance.put(name, val.getAsString());
                        } else if (memberType == Integer.class || memberType == Integer.TYPE) {
                            instance.put(name, val.getAsInt());
                        } else if (memberType == Byte.class || memberType == Byte.TYPE) {
                            instance.put(name, val.getAsByte());
                        } else if (memberType == Double.class || memberType == Double.TYPE) {
                            instance.put(name, val.getAsDouble());
                        } else if (memberType == Float.class || memberType == Float.TYPE) {
                            instance.put(name, val.getAsFloat());
                        } else if (memberType == Long.class || memberType == Long.TYPE) {
                            instance.put(name, val.getAsLong());
                        } else if (memberType == Short.class || memberType == Short.TYPE) {
                            instance.put(name, val.getAsShort());
                        } else if (memberType == Boolean.class || memberType == Boolean.TYPE) {
                            instance.put(name, val.getAsBoolean());
                        } else if (memberType == BigDecimal.class) {
                            instance.put(name, val.getAsBigDecimal());
                        } else if (memberType == BigInteger.class) {
                            instance.put(name, val.getAsBigInteger());
                        } else if (memberType == byte[].class) {
                            instance.put(name, val.getAsString().getBytes());
                        } else if (memberType == java.sql.Timestamp.class) {
                            Long time = parserDate(val.getAsString());
                            if (time == null) {
                                instance.put(name, null);
                            } else {
                                instance.put(name, new java.sql.Timestamp(time));
                            }//from w ww  . ja v  a  2s .  co m
                        } else if (memberType == java.sql.Date.class) {
                            Long time = parserDate(val.getAsString());
                            if (time == null) {
                                instance.put(name, null);
                            } else {
                                instance.put(name, new java.sql.Date(time));
                            }
                        } else if (memberType == java.util.Date.class) {
                            Long time = parserDate(val.getAsString());
                            if (time == null) {
                                instance.put(name, null);
                            } else {
                                instance.put(name, new java.util.Date(time));
                            }
                        } else {//default String
                            instance.put(name, val.getAsString());
                        }
                    } else {//String
                        instance.put(name, val.getAsString());
                    }
                }
            }
            return instance;
        }
    }
    return null;
}

From source file:org.waveprotocol.box.attachment.proto.ImageMetadataProtoImpl.java

License:Apache License

@Override
public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
    JsonObject jsonObject = json.getAsJsonObject();
    // NOTE: always check with has(...) as the json might not have all required
    // fields set; however these (obviously) will need to be set by other means
    // before accessing this object.
    invalidateAll();//w w  w .  j ava  2 s  .co m

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("1")) {
        JsonElement elem = jsonObject.get("1");
        setWidth(elem.getAsInt());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("2")) {
        JsonElement elem = jsonObject.get("2");
        setHeight(elem.getAsInt());
    }
}

From source file:org.waveprotocol.box.common.comms.proto.ProtocolSubmitResponseProtoImpl.java

License:Apache License

@Override
public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
    JsonObject jsonObject = json.getAsJsonObject();
    // NOTE: always check with has(...) as the json might not have all required
    // fields set; however these (obviously) will need to be set by other means
    // before accessing this object.
    invalidateAll();//from   w  ww  . j a va2  s. c om

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("1")) {
        JsonElement elem = jsonObject.get("1");
        setOperationsApplied(elem.getAsInt());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("2")) {
        JsonElement elem = jsonObject.get("2");
        if (!elem.isJsonNull()) {
            setErrorMessage(elem.getAsString());
        }
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("3")) {
        JsonElement elem = jsonObject.get("3");
        if (!elem.isJsonNull()) {
            {
                ProtocolHashedVersionProtoImpl payload = new ProtocolHashedVersionProtoImpl();
                GsonUtil.extractJsonObject(payload, elem, gson, raw);
                setHashedVersionAfterApplication(payload);
            }
        }
    }
}

From source file:org.waveprotocol.box.search.proto.SearchRequestProtoImpl.java

License:Apache License

@Override
public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
    JsonObject jsonObject = json.getAsJsonObject();
    // NOTE: always check with has(...) as the json might not have all required
    // fields set; however these (obviously) will need to be set by other means
    // before accessing this object.
    invalidateAll();/*from   w w  w  .j  ava  2 s.c om*/

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("1")) {
        JsonElement elem = jsonObject.get("1");
        setQuery(elem.getAsString());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("2")) {
        JsonElement elem = jsonObject.get("2");
        setIndex(elem.getAsInt());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("3")) {
        JsonElement elem = jsonObject.get("3");
        setNumResults(elem.getAsInt());
    }
}

From source file:org.waveprotocol.box.search.proto.SearchResponseProtoImpl.java

License:Apache License

@Override
public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
    JsonObject jsonObject = json.getAsJsonObject();
    // NOTE: always check with has(...) as the json might not have all required
    // fields set; however these (obviously) will need to be set by other means
    // before accessing this object.
    invalidateAll();/*from  w  w  w . j av a  2 s . c  o m*/

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("1")) {
        JsonElement elem = jsonObject.get("1");
        setQuery(elem.getAsString());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("2")) {
        JsonElement elem = jsonObject.get("2");
        setTotalResults(elem.getAsInt());
    }

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    if (jsonObject.has("3")) {
        JsonElement elem = jsonObject.get("3");
        {
            JsonArray array = elem.getAsJsonArray();
            for (int i = 0; i < array.size(); i++) {
                DigestProtoImpl payload = new DigestProtoImpl();
                GsonUtil.extractJsonObject(payload, array.get(i), gson, raw);
                addDigests(payload);
            }
        }
    }
}