Package org.xbill.DNS.utils.json.exception

Examples of org.xbill.DNS.utils.json.exception.JsonDeserializationException


     */
  protected JsonNode findFieldNode(final ObjectNode recordNode,
      final String fieldName) {
    final JsonNode fieldNode = recordNode.get(fieldName);
    if (fieldNode == null) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.missingField,
          fieldName, getTextualBeanType());
    }
    return fieldNode;
  }
View Full Code Here


  protected Name getNodeNameValue(final ObjectNode recordNode,
      final String fieldName) {
    try {
      return getNameFromString(getNodeStringValue(recordNode, fieldName));
    } catch (final TextParseException e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.invalidFieldValue, e,
          fieldName, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

            case STRING:
                try {
                    return NumberFormat.getInstance(Locale.getDefault()).parse(
                        fieldNode.textValue());
                } catch (final ParseException e) {
                    throw new JsonDeserializationException(
                            JsonDeserializationExceptionCode.invalidFieldValue, e,
                            fieldName, getTextualBeanType(), e.getMessage());
                }
            default:
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        fieldName, getTextualBeanType(), "Field cannot be read as a number");
        }
  }
View Full Code Here

                return fieldNode.booleanValue();
            case STRING:
                return Boolean.valueOf(
                        fieldNode.textValue());
            default:
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        fieldName, getTextualBeanType(), "Field cannot be read as a boolean");
        }
  }
View Full Code Here

        return getAddressFromString(addressNode.textValue());
      } else {
        return null;
      }
    } catch (final Throwable e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.invalidFieldValue, e,
          fieldName, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

                return getURLFromString(addressNode.textValue());
            } else {
                return null;
            }
        } catch (final Throwable e) {
            throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.invalidFieldValue, e,
                    fieldName, getTextualBeanType(), e.getMessage());
        }
    }
View Full Code Here

        DeserializationFeature.UNWRAP_ROOT_VALUE);
    final ObjectNode recordNode = reader.readTree(jsonParser);

    final JsonNode recordTypeNode = recordNode.get(TYPE_FIELD_NAME);
    if (recordTypeNode == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.missingField,
          TYPE_FIELD_NAME, "resource record");
    }
    final String recordType = recordTypeNode.textValue();
    final Class<? extends Record> recordClass = recordClassesRegistry
        .get(recordType);
    if (recordClass == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unknownResourceRecordType,
          recordType);
    }
    return reader.withType(recordClass).readValue(recordNode.toString());
  }
View Full Code Here

  protected Name getNodeNameValue(final ObjectNode recordNode,
      final String fieldName) {
    try {
      return getNameFromString(getNodeStringValue(recordNode, fieldName));
    } catch (final TextParseException e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.invalidFieldValue, e,
          fieldName, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

            case STRING:
                try {
                    return NumberFormat.getInstance(Locale.getDefault()).parse(
                        fieldNode.textValue());
                } catch (final ParseException e) {
                    throw new JsonDeserializationException(
                            JsonDeserializationExceptionCode.invalidFieldValue, e,
                            fieldName, getTextualBeanType(), e.getMessage());
                }
            default:
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        fieldName, getTextualBeanType(), "Field cannot be read as a number");
        }
  }
View Full Code Here

                return fieldNode.booleanValue();
            case STRING:
                return Boolean.valueOf(
                        fieldNode.textValue());
            default:
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        fieldName, getTextualBeanType(), "Field cannot be read as a boolean");
        }
  }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.utils.json.exception.JsonDeserializationException

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.