List of usage examples for com.fasterxml.jackson.databind.node BooleanNode TRUE
BooleanNode TRUE
To view the source code for com.fasterxml.jackson.databind.node BooleanNode TRUE.
Click Source Link
From source file:org.jsonbuilder.implementations.jackson.JacksonBooleanNode.java
public JacksonBooleanNode(Boolean value) { if (value) {/*from w w w . j a v a 2s. c o m*/ this.value = BooleanNode.TRUE; } else { this.value = BooleanNode.FALSE; } }
From source file:com.squarespace.template.JsonUtilsTest.java
@Test public void testJsonCompare() { assertEquals(JsonUtils.compare(json(1), json(1)), 0); assertEquals(JsonUtils.compare(json(1), json(2)), -1); assertEquals(JsonUtils.compare(json(2), json(1)), 1); assertEquals(JsonUtils.compare(json(1.0), json(1.0)), 0); assertEquals(JsonUtils.compare(json(1.0), json(2.0)), -1); assertEquals(JsonUtils.compare(json(2.0), json(1.0)), 1); assertEquals(JsonUtils.compare(json("a"), json("a")), 0); assertEquals(JsonUtils.compare(json("a"), json("b")), -1); assertEquals(JsonUtils.compare(json("b"), json("a")), 1); assertEquals(JsonUtils.compare(BooleanNode.TRUE, BooleanNode.TRUE), 0); assertEquals(JsonUtils.compare(BooleanNode.FALSE, BooleanNode.FALSE), 0); assertEquals(JsonUtils.compare(BooleanNode.TRUE, json("true")), 0); assertEquals(JsonUtils.compare(BooleanNode.FALSE, json("false")), 0); assertEquals(JsonUtils.compare(BooleanNode.TRUE, BooleanNode.FALSE), 1); assertEquals(JsonUtils.compare(BooleanNode.FALSE, BooleanNode.TRUE), -1); }
From source file:com.github.fge.jsonschema.keyword.validator.common.MaximumValidator.java
@Override protected void validateLong(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final JsonNode instance = data.getInstance().getNode(); final long instanceValue = instance.longValue(); final long longValue = number.longValue(); if (instanceValue < longValue) return;// w ww . j a va2 s.com if (instanceValue > longValue) { report.error(newMsg(data, bundle, "err.common.maximum.tooLarge").putArgument(keyword, number) .putArgument("found", instance)); return; } if (!exclusive) return; report.error(newMsg(data, bundle, "err.common.maximum.notExclusive").putArgument(keyword, number) .put("exclusiveMaximum", BooleanNode.TRUE)); }
From source file:com.github.fge.jsonschema.keyword.validator.common.MinimumValidator.java
@Override protected void validateLong(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final JsonNode instance = data.getInstance().getNode(); final long instanceValue = instance.longValue(); final long longValue = number.longValue(); if (instanceValue > longValue) return;// w ww . j a v a 2 s .c o m if (instanceValue < longValue) { report.error(newMsg(data, bundle, "err.common.minimum.tooSmall").putArgument(keyword, number) .putArgument("found", instance)); return; } if (!exclusive) return; report.error(newMsg(data, bundle, "err.common.minimum.notExclusive").putArgument(keyword, number) .put("exclusiveMinimum", BooleanNode.TRUE)); }
From source file:com.github.fge.jsonschema.keyword.validator.common.MaximumValidator.java
@Override protected void validateDecimal(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final JsonNode instance = data.getInstance().getNode(); final BigDecimal instanceValue = instance.decimalValue(); final BigDecimal decimalValue = number.decimalValue(); final int cmp = instanceValue.compareTo(decimalValue); if (cmp < 0) return;/*from w ww . j a va2s . co m*/ if (cmp > 0) { report.error(newMsg(data, bundle, "err.common.maximum.tooLarge").putArgument(keyword, number) .putArgument("found", instance)); return; } if (!exclusive) return; report.error(newMsg(data, bundle, "err.common.maximum.notExclusive").putArgument(keyword, number) .put("exclusiveMaximum", BooleanNode.TRUE)); }
From source file:com.github.fge.jsonschema.keyword.validator.common.MinimumValidator.java
@Override protected void validateDecimal(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final JsonNode instance = data.getInstance().getNode(); final BigDecimal instanceValue = instance.decimalValue(); final BigDecimal decimalValue = number.decimalValue(); final int cmp = instanceValue.compareTo(decimalValue); if (cmp > 0) return;//from ww w . j ava2 s . c om if (cmp < 0) { report.error(newMsg(data, bundle, "err.common.minimum.tooSmall").putArgument(keyword, number) .putArgument("found", instance)); return; } if (!exclusive) return; report.error(newMsg(data, bundle, "err.common.minimum.notExclusive").putArgument(keyword, number) .put("exclusiveMinimum", BooleanNode.TRUE)); }
From source file:com.sri.save.florahttp.FloraJsonServer.java
/** * Loads the given file into the main module, in addition to any previously loaded file. * Sets the given file as the active file. *//w w w. j a va 2 s . c o m * Note: The file should import any other files that it depends on. Import paths are * relative to the contentdir that FloraJsonServer was created with. * * @param filename JSON node containing the filename to be loaded, relative to the content * dir that this FloraJsonServer was created with. * */ public BooleanNode loadFile(String filename) throws FloraJsonServerException { logger.debug("loadFile: " + filename); try { URL url = new URL(ontBase, filename); floraWrapper.load(url); return BooleanNode.TRUE; } catch (Exception ex) { throw new FloraJsonServerException(ex.getMessage()); } }
From source file:org.openmhealth.reference.domain.SchemaTest.java
/** * Test that an exception is thrown when the schema is not a valid schema. *///from ww w . j a v a2s . co m @Test(expected = OmhException.class) public void testSchemaSchemaInvalid() { new Schema(ID, VERSION, BooleanNode.TRUE, CONTROLLER); }
From source file:com.sri.save.FloraJsonServer.java
/** * Loads the given file into the main module, overriding any previously loaded file. * Sets the given file as the active file. *//w ww . ja v a 2 s . c o m * Note: The file should import any other files that it depends on. Import paths are * relative to the contentdir that FloraJsonServer was created with. * * @param filename JSON node containing the filename to be loaded, relative to the content * dir that this FloraJsonServer was created with. * */ public BooleanNode loadFile(String filename) throws FloraJsonServerException { logger.debug("loadFile: " + filename); // Load a flora file (to the "main" module - always use this) try { boolean success = engine.loadFile(filename, "main"); if (!success) return BooleanNode.FALSE; activeFile = new File(contentDir + File.separator + filename); logger.debug("Set active file to: " + activeFile.getAbsolutePath()); docService.setActiveFile(activeFile); return BooleanNode.TRUE; } catch (FlrException ex) { throw new FloraJsonServerException(ex.getMessage()); } }
From source file:org.walkmod.conf.providers.yml.AbstractYMLConfigurationAction.java
public void createTransformation(ObjectNode transformationNode, TransformationConfig transCfg) { String name = transCfg.getName(); if (name != null) { transformationNode.set("name", new TextNode(name)); }// w ww.ja v a2s .co m String typeName = transCfg.getType(); if (typeName != null) { transformationNode.set("type", new TextNode(typeName)); } String mergePolicy = transCfg.getMergePolicy(); if (mergePolicy != null) { transformationNode.set("merge-policy", new TextNode(mergePolicy)); } if (transCfg.isMergeable()) { transformationNode.set("isMergeable", BooleanNode.TRUE); } Map<String, Object> params = transCfg.getParameters(); if (params != null && !params.isEmpty()) { populateParams(transformationNode, params); } }