List of usage examples for com.fasterxml.jackson.databind JsonNode textValue
public String textValue()
From source file:ml.shifu.shifu.container.obj.RunModeDeserializer.java
@Override public RunMode deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec();/*from w ww . j av a 2s. c o m*/ JsonNode node = oc.readTree(jp); for (RunMode value : RunMode.values()) { if (value.name().equalsIgnoreCase(node.textValue())) { return value; } } return null; }
From source file:com.wealdtech.jackson.modules.PeriodDeserializer.java
@Override public Period deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final ObjectCodec oc = jsonParser.getCodec(); final JsonNode node = oc.readTree(jsonParser); Period result = null;//from w w w . j ava2 s . com try { result = formatter.parsePeriod(node.textValue()); } catch (IllegalArgumentException iae) { LOGGER.warn("Attempt to deserialize invalid period {}", node.textValue()); throw new IOException("Invalid period value", iae); } return result; }
From source file:ml.shifu.shifu.container.obj.SouceTypeDeserializer.java
@Override public SourceType deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec();//w w w.j av a2 s . c o m JsonNode node = oc.readTree(jp); for (SourceType value : SourceType.values()) { if (value.name().equalsIgnoreCase(node.textValue())) { return value; } } return null; }
From source file:com.doitnext.mojo.pojo.jsonschemagen.Pojo2JsonSchemaMojo.java
private void scanClass(Class<?> classz) throws MojoExecutionException { String json = SchemaGen.toSchema(classz, uriPathPrefix); try {/*from w w w. j a v a2 s.co m*/ JsonNode node = objectMapper.readTree(json); JsonNode idNode = node.get("id"); String id = idNode.textValue(); File f = new File(schemaOutputDirectory, id + ".schema.json"); objectMapper.writeValue(f, node); } catch (Exception e) { System.err.println(json); throw new MojoExecutionException("Failed to handle class " + classz.getName(), e); } }
From source file:com.rusticisoftware.tincan.AgentAccount.java
public AgentAccount(JsonNode jsonNode) { this();/*from w w w . j a va 2 s .c o m*/ JsonNode homePageNode = jsonNode.path("homePage"); if (!homePageNode.isMissingNode()) { this.setHomePage(homePageNode.textValue()); } JsonNode nameNode = jsonNode.path("name"); if (!nameNode.isMissingNode()) { this.setName(nameNode.textValue()); } }
From source file:com.wealdtech.jackson.modules.LocalDateDeserializer.java
@Override public LocalDate deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final ObjectCodec oc = jsonParser.getCodec(); final JsonNode node = oc.readTree(jsonParser); LocalDate result = null;/*from w w w .j a v a 2 s . c o m*/ try { result = formatter.parseLocalDate(node.textValue()); } catch (IllegalArgumentException iae) { LOGGER.warn("Attempt to deserialize invalid localdate {}", node.textValue()); throw new IOException("Invalid localdate value \"" + node.textValue() + "\"", iae); } return result; }
From source file:ml.shifu.shifu.container.obj.BinningMethodDeserializer.java
@Override public BinningMethod deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec();//from w ww.j a v a 2 s .c om JsonNode node = oc.readTree(jp); for (BinningMethod value : BinningMethod.values()) { if (value.name().equalsIgnoreCase(node.textValue())) { return value; } } return null; }
From source file:net.sf.taverna.t2.activities.apiconsumer.views.ApiConsumerConfigView.java
private Component createDependenciesPanel() { String classLoaderSharing = getProperty("classLoaderSharing"); List<String> localDependencies = new ArrayList<>(); if (getJson().has("localDependency")) { for (JsonNode localDependency : getJson().get("localDependency")) { localDependencies.add(localDependency.textValue()); }//from w ww. ja v a2s .c o m } dependencyConfigurationPanel = new DependencyConfigurationPanel(classLoaderSharing, localDependencies, libDir); return dependencyConfigurationPanel; }
From source file:com.github.fge.jsonschema.keyword.validator.common.AdditionalPropertiesValidator.java
public AdditionalPropertiesValidator(final JsonNode digest) { super("additionalProperties"); additionalOK = digest.get(keyword).booleanValue(); ImmutableSet.Builder<String> builder; builder = ImmutableSet.builder();/* w w w .j a v a2 s .com*/ for (final JsonNode node : digest.get("properties")) builder.add(node.textValue()); properties = builder.build(); builder = ImmutableSet.builder(); for (final JsonNode node : digest.get("patternProperties")) builder.add(node.textValue()); patternProperties = builder.build(); }