Java Code Examples for com.fasterxml.jackson.core.JsonLocation#NA
The following examples show how to use
com.fasterxml.jackson.core.JsonLocation#NA .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitlibJsonModule.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
@Override public Sha256Hash deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Sha256Hash hash = Sha256Hash.fromString(node.asText()); if (hash == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into a Sha256 hash", JsonLocation.NA); } return hash; }
Example 2
Source File: BitlibJsonModule.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
@Override public Address deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Address address = Address.fromString(node.asText()); if (address == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an address", JsonLocation.NA); } return address; }
Example 3
Source File: BitlibJsonModule.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
@Override public PublicKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); byte[] pubKeyBytes; try { pubKeyBytes = HexUtils.toBytes(node.asText()); } catch (RuntimeException e) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an public key bytes", JsonLocation.NA); } return new PublicKey(pubKeyBytes); }
Example 4
Source File: BitlibJsonModule.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
@Override public Sha256Hash deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Sha256Hash hash = Sha256Hash.fromString(node.asText()); if (hash == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into a Sha256 hash", JsonLocation.NA); } return hash; }
Example 5
Source File: BitlibJsonModule.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
@Override public Address deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Address address = Address.fromString(node.asText()); if (address == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an address", JsonLocation.NA); } return address; }
Example 6
Source File: BitlibJsonModule.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
@Override public PublicKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); byte[] pubKeyBytes; try { pubKeyBytes = HexUtils.toBytes(node.asText()); } catch (RuntimeException e) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an public key bytes", JsonLocation.NA); } return new PublicKey(pubKeyBytes); }
Example 7
Source File: BitlibJsonModule.java From bitshares_wallet with MIT License | 5 votes |
@Override public Sha256Hash deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Sha256Hash hash = Sha256Hash.fromString(node.asText()); if (hash == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into a Sha256 hash", JsonLocation.NA); } return hash; }
Example 8
Source File: BitlibJsonModule.java From bitshares_wallet with MIT License | 5 votes |
@Override public Address deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); Address address = Address.fromString(node.asText()); if (address == null) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an address", JsonLocation.NA); } return address; }
Example 9
Source File: BitlibJsonModule.java From bitshares_wallet with MIT License | 5 votes |
@Override public PublicKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); byte[] pubKeyBytes; try { pubKeyBytes = HexUtils.toBytes(node.asText()); } catch (RuntimeException e) { throw new JsonParseException("Failed to convert string '" + node.asText() + "' into an public key bytes", JsonLocation.NA); } return new PublicKey(pubKeyBytes); }
Example 10
Source File: UserDeserializer.java From osiam with MIT License | 5 votes |
@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(); }
Example 11
Source File: JacksonStreamReaderImpl.java From aws-dynamodb-mars-json-demo with Apache License 2.0 | 5 votes |
/** * 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(); } }
Example 12
Source File: Values.java From Bats with Apache License 2.0 | 4 votes |
public Builder content(JsonNode n){ content = new JSONOptions(n, JsonLocation.NA); return this; }
Example 13
Source File: Values.java From dremio-oss with Apache License 2.0 | 4 votes |
public Builder content(JsonNode n){ content = new JSONOptions(n, JsonLocation.NA); return this; }
Example 14
Source File: HoconTreeTraversingParser.java From jackson-dataformat-hocon with Apache License 2.0 | 4 votes |
@Override public JsonLocation getTokenLocation() { final ConfigValue node = currentNode(); return node == null ? JsonLocation.NA : new HoconJsonLocation(node.origin()); }
Example 15
Source File: HoconTreeTraversingParser.java From jackson-dataformat-hocon with Apache License 2.0 | 4 votes |
@Override public JsonLocation getCurrentLocation() { final ConfigValue node = currentNode(); return node == null ? JsonLocation.NA : new HoconJsonLocation(node.origin()); }
Example 16
Source File: DrillValuesRelBase.java From Bats with Apache License 2.0 | 3 votes |
/** * Converts tuples into json representation taking into account row type. * Example: [['A']] -> [{"EXPR$0":"A"}], [[1]] -> [{"EXPR$0":{"$numberLong":1}}] * * @param rowType row type * @param tuples list of constant values in a row-expression * @return json representation of tuples */ private static JSONOptions convertToJsonOptions(RelDataType rowType, List<? extends List<RexLiteral>> tuples) { try { return new JSONOptions(convertToJsonNode(rowType, tuples), JsonLocation.NA); } catch (IOException e) { throw new DrillRuntimeException("Failure while attempting to encode Values in JSON.", e); } }