當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonLocation.NA屬性代碼示例

本文整理匯總了Java中com.fasterxml.jackson.core.JsonLocation.NA屬性的典型用法代碼示例。如果您正苦於以下問題:Java JsonLocation.NA屬性的具體用法?Java JsonLocation.NA怎麽用?Java JsonLocation.NA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.fasterxml.jackson.core.JsonLocation的用法示例。


在下文中一共展示了JsonLocation.NA屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deserialize

@Override
public User deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    JsonNode rootNode = jp.readValueAsTree();

    User user = MAPPER.readValue(rootNode.traverse(), User.class);
    if (user.getSchemas() == null) {
        throw new JsonMappingException(jp, "Required field 'schemas' is missing");
    }
    if (user.getSchemas().size() == 1) {
        return user;
    }

    User.Builder builder = new User.Builder(user);

    for (String urn : user.getSchemas()) {
        if (urn.equals(schema)) {
            continue;
        }

        JsonNode extensionNode = rootNode.get(urn);
        if (extensionNode == null) {
            throw new JsonParseException(jp, "Registered extension not present: " + urn, JsonLocation.NA);
        }

        builder.addExtension(deserializeExtension(jp, extensionNode, urn));

    }
    return builder.build();
}
 
開發者ID:osiam,項目名稱:osiam,代碼行數:29,代碼來源:UserDeserializer.java

示例2: _reportInvalidBase64

protected final void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString)
{
  String str;
  if (paramChar <= ' ')
    str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units";
  else if (paramBase64Variant.usesPaddingChar(paramChar))
    str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character";
  else if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar)))
    str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
  else
    str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
  if (paramString != null)
    str = str + ": " + paramString;
  throw new JsonParseException(str, JsonLocation.NA);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:15,代碼來源:TextNode.java

示例3: doSerializeV3

@Override
public void doSerializeV3(final JSONProperty property, final JsonGenerator jgen, final SerializerProvider provider)
        throws IOException, JsonProcessingException {

    jgen.writeStartObject();

    if (property.getMetadata() != null) {
        jgen.writeStringField(ODataConstants.JSON_METADATA, property.getMetadata().toASCIIString());
    }

    final Element content = property.getContent();
    if (XMLUtils.hasOnlyTextChildNodes(content)) {
        jgen.writeStringField(ODataConstants.JSON_VALUE, content.getTextContent());
    } else {
        try {
            final DocumentBuilder builder = ODataConstants.DOC_BUILDER_FACTORY.newDocumentBuilder();
            final Document document = builder.newDocument();
            final Element wrapper = document.createElement(ODataConstants.ELEM_PROPERTY);

            if (XMLUtils.hasElementsChildNode(content)) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtils.writeSubtree(client, jgen, wrapper);
            } else if (EdmSimpleType.isGeospatial(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtilsV3.writeSubtree(client, jgen, wrapper, true);
            } else {
                DOMTreeUtils.writeSubtree(client, jgen, content);
            }
        } catch (Exception e) {
            throw new JsonParseException("Cannot serialize property", JsonLocation.NA, e);
        }
    }

    jgen.writeEndObject();
}
 
開發者ID:ashank,項目名稱:Office-365-SDK-for-Android,代碼行數:39,代碼來源:JSONPropertySerializer.java

示例4: doSerializeV4

@Override
public void doSerializeV4(final JSONProperty property, final JsonGenerator jgen, final SerializerProvider provider)
        throws IOException, JsonProcessingException {

    jgen.writeStartObject();

    final Element content = property.getContent();
    if (XMLUtils.hasOnlyTextChildNodes(content)) {
        jgen.writeStringField(ODataConstants.JSON_VALUE, content.getTextContent());
    } else {
        try {
            final DocumentBuilder builder = ODataConstants.DOC_BUILDER_FACTORY.newDocumentBuilder();
            final Document document = builder.newDocument();
            final Element wrapper = document.createElement(ODataConstants.ELEM_PROPERTY);

            if (XMLUtils.hasElementsChildNode(content)) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtils.writeSubtree(client, jgen, wrapper);
            } else if (EdmSimpleType.isGeospatial(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtilsV4.writeSubtree(client, jgen, wrapper, true);
            } else {
                DOMTreeUtils.writeSubtree(client, jgen, content);
            }
        } catch (Exception e) {
            throw new JsonParseException("Cannot serialize property", JsonLocation.NA, e);
        }
    }

    jgen.writeEndObject();
}
 
開發者ID:ashank,項目名稱:Office-365-SDK-for-Android,代碼行數:35,代碼來源:JSONPropertySerializer.java

示例5: deserialize

@Override
public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

    try {
        return sdf.parse(jsonParser.getText());
    } catch (ParseException ex) {
        try {
            long numericDate = Long.parseLong(jsonParser.getText());
            return new Date(numericDate);
        } catch (NumberFormatException ex2) {
            throw new JsonParseException ("El formato de la fecha '" + jsonParser.getText() + "' no es correcto",JsonLocation.NA);
        }
    }
}
 
開發者ID:ix3,項目名稱:ix3,代碼行數:15,代碼來源:DateDeserializer.java

示例6: JacksonStreamReaderImpl

/**
 * Constructs a {@link JacksonStreamReaderImpl} with the provided {@link JsonParser}.
 *
 * @param jp
 *            JsonParser from which to get tokens
 * @throws IOException
 *             Null JsonParser or error getting token
 */
public JacksonStreamReaderImpl(final JsonParser jp) throws IOException {
    if (jp == null) {
        throw new JacksonStreamReaderException("JsonParser cannot be null", JsonLocation.NA);
    }
    this.jp = jp;
    if (jp.getCurrentToken() == null) {
        jp.nextToken();
    }
}
 
開發者ID:awslabs,項目名稱:aws-dynamodb-mars-json-demo,代碼行數:17,代碼來源:JacksonStreamReaderImpl.java

示例7: shouldTranslateJsonParseException

@Test
public void shouldTranslateJsonParseException() {
    String originalMessage = "originalMessage";
    JsonParseException jsonParseException = new JsonParseException(originalMessage, JsonLocation.NA);

    Exception translatedException =
            JsonProcessingExceptionTranslator.translateJsonProcessingException(jsonParseException);

    assertThat(translatedException, instanceOf(DNSAPIClientJsonMappingException.class));
    assertEquals(DNSAPIClientJsonMappingException.DNSAPIClientJsonMappingExceptionCode.unexpectedMappingError,
            ((DNSAPIClientJsonMappingException) translatedException).getExceptionCode());
    assertArrayEquals(new Object[] {"unknown", originalMessage + "\n at [Source: N/A; line: -1, column: -1]"},
            ((DNSAPIClientJsonMappingException) translatedException).getObjects());
}
 
開發者ID:discoverydns,項目名稱:dnsapi-client,代碼行數:14,代碼來源:JsonProcessingExceptionTranslatorTest.java

示例8: getTokenLocation

@Override
public JsonLocation getTokenLocation() {
    ConfigValue current = currentConfig();
    if (current == null) {
        return JsonLocation.NA;
    }
    ConfigOrigin nodeOrigin = current.origin();
    return new JsonLocation(current, -1, nodeOrigin.lineNumber(), -1);
}
 
開發者ID:addthis,項目名稱:codec,代碼行數:9,代碼來源:ConfigTraversingParser.java

示例9: serialize

/**
 * {@inheritDoc }
 */
@Override
public void serialize(final JSONProperty property, final JsonGenerator jgen, final SerializerProvider provider)
        throws IOException, JsonProcessingException {

    jgen.writeStartObject();

    if (property.getMetadata() != null) {
        jgen.writeStringField(ODataConstants.JSON_METADATA, property.getMetadata().toASCIIString());
    }

    final Element content = property.getContent();
    if (XMLUtils.hasOnlyTextChildNodes(content)) {
        jgen.writeStringField(ODataConstants.JSON_VALUE, content.getTextContent());
    } else {
        try {
            final DocumentBuilder builder = ODataConstants.DOC_BUILDER_FACTORY.newDocumentBuilder();
            final Document document = builder.newDocument();
            final Element wrapper = document.createElement(ODataConstants.ELEM_PROPERTY);

            if (XMLUtils.hasElementsChildNode(content)) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtils.writeSubtree(jgen, wrapper);
            } else if (EdmSimpleType.isGeospatial(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
                wrapper.appendChild(document.renameNode(
                        document.importNode(content, true), null, ODataConstants.JSON_VALUE));

                DOMTreeUtils.writeSubtree(jgen, wrapper, true);
            } else {
                DOMTreeUtils.writeSubtree(jgen, content);
            }
        } catch (Exception e) {
            throw new JsonParseException("Cannot serialize property", JsonLocation.NA, e);
        }
    }

    jgen.writeEndObject();
}
 
開發者ID:mkostin,項目名稱:ODataJClient,代碼行數:42,代碼來源:JSONPropertySerializer.java

示例10: content

public Builder content(JsonNode n){
  content = new JSONOptions(n, JsonLocation.NA);
  return this;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:4,代碼來源:Values.java

示例11: _reportUndetectableSource

protected void _reportUndetectableSource(Object paramObject)
{
  throw new JsonParseException("Can not use source of type " + paramObject.getClass().getName() + " with format auto-detection: must be byte- not char-based", JsonLocation.NA);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:4,代碼來源:ObjectReader.java

示例12: _reportUnkownFormat

protected void _reportUnkownFormat(DataFormatReaders paramDataFormatReaders, DataFormatReaders.Match paramMatch)
{
  throw new JsonParseException("Can not detect format from input, does not look like any of detectable formats " + paramDataFormatReaders.toString(), JsonLocation.NA);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:4,代碼來源:ObjectReader.java

示例13: getCurrentLocation

public final JsonLocation getCurrentLocation()
{
  if (this._location == null)
    return JsonLocation.NA;
  return this._location;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:6,代碼來源:TokenBuffer.java

示例14: getCurrentLocation

public JsonLocation getCurrentLocation()
{
  return JsonLocation.NA;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:4,代碼來源:TreeTraversingParser.java

示例15: getTokenLocation

public JsonLocation getTokenLocation()
{
  return JsonLocation.NA;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:4,代碼來源:TreeTraversingParser.java


注:本文中的com.fasterxml.jackson.core.JsonLocation.NA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。