本文整理了Java中org.n52.janmayen.Json.nodeFactory()
方法的一些代码示例,展示了Json.nodeFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.nodeFactory()
方法的具体详情如下:
包路径:org.n52.janmayen.Json
类名称:Json
方法名:nodeFactory
暂无
代码示例来源:origin: org.n52.janmayen/janmayen
private static JsonNode toJSONString(Object object) {
if (object == null) {
return nodeFactory().nullNode();
} else if (object instanceof JsonNode) {
return (JsonNode) object;
} else {
return nodeFactory().textNode(String.valueOf(object));
}
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static ObjectNode toJSON(Map<String, ?> map) {
ObjectNode node = nodeFactory().objectNode();
Optional.ofNullable(map).orElseGet(Collections::emptyMap)
.forEach((key, value) -> node.set(key, toJSONString(value)));
return node;
}
代码示例来源:origin: org.n52.wps/service
@ResponseBody
@RequestMapping(
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public String info() {
return Json.print(Json.nodeFactory().objectNode().put(ENDPOINT, this.serviceURL).put(BRANCH, this.branch).put(
COMMIT, this.commit).put(TIME, this.time).put(VERSION, this.version));
}
代码示例来源:origin: 52North/SOS
public static String mapToJson(@SuppressWarnings("rawtypes") Map map) {
ObjectNode node = Json.nodeFactory().objectNode();
for (Object key : map.keySet()) {
node.put(key.toString(), String.valueOf(map.get(key)));
}
return Json.print(node);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_BINDINGS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() {
ObjectNode node = Json.nodeFactory().objectNode();
node.set(JSONConstants.BINDINGS_KEY, getBindings());
return Json.print(node);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
private ObjectNode toJson(final Collection<SosObservationOfferingExtension> extensionsForOffering) {
ObjectNode jsonOffering = Json.nodeFactory().objectNode();
if (extensionsForOffering != null) {
for (final SosObservationOfferingExtension e : extensionsForOffering) {
jsonOffering.set(e.getIdentifier(), toJson(e));
}
}
return jsonOffering;
}
代码示例来源:origin: 52North/SOS
private ObjectNode toJson(final Collection<SosObservationOfferingExtension> extensionsForOffering) {
ObjectNode jsonOffering = Json.nodeFactory().objectNode();
if (extensionsForOffering != null) {
for (final SosObservationOfferingExtension e : extensionsForOffering) {
jsonOffering.set(e.getIdentifier(), toJson(e));
}
}
return jsonOffering;
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_EXTENSIONS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() throws JSONException, ConnectionProviderException {
ObjectNode node = Json.nodeFactory().objectNode();
node.set(JSONConstants.EXTENDED_CAPABILITIES_EXTENSION_KEY, getExtendedCapabilitiesExtensions());
node.set(JSONConstants.OFFERING_EXTENSION_EXTENSION_KEY, getOfferingExtensionExtensions());
return Json.print(node);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_ENCODINGS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() {
ObjectNode node = Json.nodeFactory().objectNode();
node.set(JSONConstants.OBSERVATION_ENCODINGS_KEY, getObservationEncodings());
node.set(JSONConstants.PROCEDURE_ENCODINGS_KEY, getProcedureEncodings());
return Json.print(node);
}
代码示例来源:origin: 52North/SOS
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_EXTENSIONS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() throws JSONException, ConnectionProviderException {
ObjectNode node = Json.nodeFactory().objectNode();
node.set(JSONConstants.EXTENDED_CAPABILITIES_EXTENSION_KEY, getExtendedCapabilitiesExtensions());
node.set(JSONConstants.OFFERING_EXTENSION_EXTENSION_KEY, getOfferingExtensionExtensions());
return Json.print(node);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
private JsonNode toJson(StringBasedCapabilitiesExtension capabilitiesExtension) {
return Json.nodeFactory().objectNode()
.put(IDENTIFIER_PROPERTY, capabilitiesExtension.getSectionName())
.put(DISABLED_PROPERTY, capabilitiesExtension.isDisabled())
.put(EXTENSION_PROPERTY, capabilitiesExtension.getExtension());
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_LOADING, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheLoadingStatus() throws JSONException, UnavailableException {
checkConfiguratorAvailability();
return Json.print(Json.nodeFactory().objectNode().put("loading", cacheIsLoading()));
}
代码示例来源:origin: 52North/SOS
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_LOADING, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheLoadingStatus() throws JSONException, UnavailableException {
checkConfiguratorAvailability();
return Json.print(Json.nodeFactory().objectNode().put("loading", cacheIsLoading()));
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public String encode(ProcessingReport report, JsonNode instance) {
ObjectNode objectNode = Json.nodeFactory().objectNode();
objectNode.set(JSONConstants.INSTANCE, instance);
ArrayNode errors = objectNode.putArray(JSONConstants.ERRORS);
for (ProcessingMessage m : report) {
errors.add(m.asJson());
}
return Json.print(objectNode);
}
代码示例来源:origin: 52North/SOS
private ObjectNode toJson(final SosObservationOfferingExtension extensionForOffering) {
return Json.nodeFactory().objectNode()
.put(IDENTIFIER_PROPERTY, extensionForOffering.getIdentifier())
.put(DISABLED_PROPERTY, extensionForOffering.isDisabled())
.put(EXTENSION_PROPERTY, extensionForOffering.getExtension())
.put(OFFERING, extensionForOffering.getOfferingName());
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
@Override
public JsonNode encodeJSON(T t) throws EncodingException {
ObjectNode n = Json.nodeFactory().objectNode();
n.put(JSONConstants.REQUEST, t.getOperationName());
n.put(JSONConstants.VERSION, t.getVersion());
n.put(JSONConstants.SERVICE, t.getService());
encodeResponse(n, t);
return n;
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
protected ArrayNode getBindings() {
Map<MediaType, Binding> bindings = bindingRepository.getAllBindingsByMediaType();
ArrayNode a = Json.nodeFactory().arrayNode();
for (Entry<MediaType, Binding> e : bindings.entrySet()) {
MediaType mediaType = e.getKey();
a.addObject()
.put(JSONConstants.BINDING_KEY, mediaType.toString())
.put(JSONConstants.ACTIVE_KEY, this.bindingRepository.isActive(new MediaTypeBindingKey(mediaType)));
}
return a;
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
@Override
public JsonNode encodeJSON(ReportObligation header)
throws EncodingException {
ObjectNode j = Json.nodeFactory().objectNode();
j.set(AQDJSONConstants.CHANGE, encodeObjectToJson(header.getChange()));
j.set(AQDJSONConstants.INSPIRE_ID, encodeObjectToJson(header.getInspireID()));
j.set(AQDJSONConstants.REPORTING_PERIOD, encodeObjectToJson(header.getReportingPeriod()));
return j;
}
}
代码示例来源:origin: 52North/SOS
protected ArrayNode getBindings() {
Map<MediaType, Binding> bindings = bindingRepository.getAllBindingsByMediaType();
ArrayNode a = Json.nodeFactory().arrayNode();
for (Entry<MediaType, Binding> e : bindings.entrySet()) {
MediaType mediaType = e.getKey();
a.addObject()
.put(JSONConstants.BINDING_KEY, mediaType.toString())
.put(JSONConstants.ACTIVE_KEY, this.bindingRepository.isActive(new MediaTypeBindingKey(mediaType)));
}
return a;
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
private JsonNode encodeSettings(Properties p) throws JSONException {
JsonSettingsEncoder enc = getSettingsEncoder();
Set<SettingDefinition<?>> defs = getDatasource().getChangableSettingDefinitions(p);
JsonNode settings = enc.encode(enc.sortByGroup(defs));
ObjectNode node = Json.nodeFactory().objectNode();
node.set(SETTINGS, settings);
return node;
}
内容来源于网络,如有侵权,请联系作者删除!