Package org.chromium.sdk.internal.protocolparser

Examples of org.chromium.sdk.internal.protocolparser.JsonProtocolParseException


        throws JsonProtocolParseException {
      if (isNullable && value == null) {
        return null;
      }
      if (value instanceof JSONArray == false) {
        throw new JsonProtocolParseException("Array value expected");
      }
      JSONArray arrayValue = (JSONArray) value;
      return listFactory.create(arrayValue, componentParser);
    }
View Full Code Here


    @Override
    void parseObjectSubtype(ObjectData objectData, Map<?, ?> jsonProperties,
        Object input) throws JsonProtocolParseException {
      if (jsonProperties == null) {
        throw new JsonProtocolParseException(
            "JSON object input expected for non-manual subtyping");
      }
      int code = -1;
      for (int i = 0; i < this.getSubtypes().size(); i++) {
        TypeHandler<?> nextSubtype = this.getSubtypes().get(i).get();
        boolean ok = nextSubtype.getSubtypeSupport().checkConditions(jsonProperties);
        if (ok) {
          if (code == -1) {
            code = i;
          } else {
            throw new JsonProtocolParseException("More than one case match");
          }
        }
      }
      if (code == -1) {
        if (!this.hasDefaultCase) {
          throw new JsonProtocolParseException("Not a singe case matches");
        }
      } else {
        ObjectData fieldData =
            this.getSubtypes().get(code).get().parse(input, objectData);
        objectData.getFieldArray()[this.variantValueFieldPos] = fieldData;
View Full Code Here

      throws JsonProtocolParseException {
    if (hasValue) {
      try {
        objectData.getFieldArray()[fieldPosInArray] = slowParser.parseValue(value, objectData);
      } catch (JsonProtocolParseException e) {
        throw new JsonProtocolParseException("Failed to parse field " + getFieldName(), e);
      }
    } else {
      if (!isOptional) {
        throw new JsonProtocolParseException("Field is not optional: " + getFieldName());
      }
    }
  }
View Full Code Here

      throws JsonProtocolParseException {
    if (isNullable && value == null) {
      return null;
    }
    if (value == null) {
      throw new JsonProtocolParseException("null input");
    }
    TypeHandler<T> typeHandler = refToType.get();
    if (isSubtyping) {
      return typeHandler.parse(value, thisData);
    } else {
View Full Code Here

TOP

Related Classes of org.chromium.sdk.internal.protocolparser.JsonProtocolParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.