List of usage examples for com.fasterxml.jackson.databind JsonNode textValue
public String textValue()
From source file:org.pac4j.oauth.profile.converter.MockJsonObject.java
@Override protected void buildFromJson(final JsonNode json) { this.value = json.textValue(); }
From source file:org.eel.kitchen.jsonschema.keyword.MaxLengthKeywordValidator.java
@Override public void validate(final ValidationContext context, final ValidationReport report, final JsonNode instance) { final int len = instance.textValue().length(); if (len <= intValue) return;//from w w w . j a v a 2s. c om final Message.Builder msg = newMsg().addInfo(keyword, intValue).addInfo("found", len) .setMessage("string is too long"); report.addMessage(msg.build()); }
From source file:org.eel.kitchen.jsonschema.keyword.MinLengthKeywordValidator.java
@Override public void validate(final ValidationContext context, final ValidationReport report, final JsonNode instance) { final int len = instance.textValue().length(); if (len >= intValue) return;/*w ww . j a v a2 s.c o m*/ final Message.Builder msg = newMsg().addInfo(keyword, intValue).addInfo("found", len) .setMessage("string is too short"); report.addMessage(msg.build()); }
From source file:com.github.fge.jsonschema2avro.writers.EnumWriter.java
@Override protected Schema generate(final AvroWriterProcessor writer, final ProcessingReport report, final SchemaTree tree) throws ProcessingException { final JsonNode enumNode = tree.getNode().get("enum"); final List<String> values = Lists.newArrayList(); for (final JsonNode element : enumNode) values.add(element.textValue()); return Schema.createEnum(getName(), null, null, values); }
From source file:org.eel.kitchen.jsonschema.format.URIFormatAttribute.java
@Override public void checkValue(final String fmt, final ValidationContext ctx, final ValidationReport report, final JsonNode value) { try {//from w w w. j ava 2 s .com new URI(value.textValue()); } catch (URISyntaxException ignored) { final Message.Builder msg = newMsg(fmt).setMessage("string is not a valid URI").addInfo("value", value); report.addMessage(msg.build()); } }
From source file:org.eel.kitchen.jsonschema.format.IPV4FormatAttribute.java
@Override public void checkValue(final String fmt, final ValidationContext ctx, final ValidationReport report, final JsonNode value) { final String ipaddr = value.textValue(); if (InetAddresses.isInetAddress(ipaddr) && InetAddresses.forString(ipaddr).getAddress().length == IPV4_LENGTH) return;// www . j a v a2s.c o m final Message.Builder msg = newMsg(fmt).setMessage("string is not a valid IPv4 address").addInfo("value", value); report.addMessage(msg.build()); }
From source file:org.eel.kitchen.jsonschema.format.IPV6FormatAttribute.java
@Override public void checkValue(final String fmt, final ValidationContext ctx, final ValidationReport report, final JsonNode value) { final String ipaddr = value.textValue(); if (InetAddresses.isInetAddress(ipaddr) && InetAddresses.forString(ipaddr).getAddress().length == IPV6_LENGTH) return;/* w ww.jav a2 s . com*/ final Message.Builder msg = newMsg(fmt).setMessage("string is not a valid IPv6 address").addInfo("value", value); report.addMessage(msg.build()); }
From source file:org.eel.kitchen.jsonschema.format.RegexFormatAttribute.java
@Override public void checkValue(final String fmt, final ValidationContext ctx, final ValidationReport report, final JsonNode value) { if (RhinoHelper.regexIsValid(value.textValue())) return;/* www. j ava 2s .c o m*/ final Message.Builder msg = newMsg(fmt).setMessage("string is not a valid ECMA 262 regular expression") .addInfo("value", value); report.addMessage(msg.build()); }
From source file:org.eel.kitchen.jsonschema.keyword.PatternKeywordValidator.java
@Override public void validate(final ValidationContext context, final ValidationReport report, final JsonNode instance) { if (RhinoHelper.regMatch(regex, instance.textValue())) return;//from w w w .ja va 2s .com final Message.Builder msg = newMsg().addInfo("regex", regex).addInfo("string", instance) .setMessage("ECMA 262 regex does not match input string"); report.addMessage(msg.build()); }
From source file:yadarts.server.decoding.GameDecoder.java
private List<Player> decodePlayers(JsonNode jsonNode) { List<Player> result = new ArrayList<>(); if (jsonNode.isArray()) { for (JsonNode p : jsonNode) { result.add(new PlayerImpl(p.textValue())); }/*from w w w.j av a 2 s . c o m*/ } return result; }