本文整理汇总了Java中elemental.json.JsonValue类的典型用法代码示例。如果您正苦于以下问题:Java JsonValue类的具体用法?Java JsonValue怎么用?Java JsonValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonValue类属于elemental.json包,在下文中一共展示了JsonValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
putNotNull(map, "customClassOption", customClassOption);
putNotNull(map, "customClassOptionText", customClassOptionText);
putNotNull(map, "linkValidation", linkValidation);
putNotNull(map, "placeholderText", placeholderText);
putNotNull(map, "targetCheckbox", targetCheckbox);
putNotNull(map, "targetCheckboxText", targetCheckboxText);
return map;
}
示例2: deserializeOps
import elemental.json.JsonValue; //导入依赖的package包/类
private List<RealtimeOperation> deserializeOps(List<Delta<String>> changes) throws DeltaRejected {
List<RealtimeOperation> ops = new ArrayList<RealtimeOperation>();
for (Delta<String> delta : changes) {
RealtimeOperation op;
try {
JsonValue serialized = Json.instance().parse(delta.getPayload());
op =
transformer.createOperation(delta.getSession().userId, delta.getSession().sessionId,
serialized);
} catch (JsonException e) {
throw new DeltaRejected(e);
}
ops.add(op);
}
return ops;
}
示例3: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
if (icon != null) {
String contentFA = icon.getHtml();
if (iconText != null) {
contentFA += iconText;
}
putNotNull(map, "contentFA", contentFA);
}
putNotNull(map, "contentDefault", iconFallback);
if (customTranslation) {
putNotNull(map, "aria", aria);
} else {
// get buildin translations
putNotNull(map, "aria", toolbarBuilder.getOptionsBuilder().getTranslation(aria));
}
putNotNull(map, "name", name);
putNotNull(map, "action", action == null ? name : action);
putNotNull(map, "tagNames", tagNames);
putNotNull(map, "style", style);
putNotNull(map, "useQueryState", useQueryState);
putNotNull(map, "classList", classList);
putNotNull(map, "attrs", attrs);
return map;
}
示例4: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
putNotNull(map, "allowMultiParagraphSelection", allowMultiParagraphSelection);
if (buttons != null) {
JsonArray btnList = Json.createArray();
for (ToolbarButtonBuilder tbb : buttons) {
btnList.set(btnList.length(), tbb.buildJson());
}
map.put("buttons", btnList);
}
putNotNull(map, "diffLeft", diffLeft);
putNotNull(map, "diffTop", diffLeft);
putNotNull(map, "firstButtonClass", firstButtonClass);
putNotNull(map, "lastButtonClass", lastButtonClass);
putNotNull(map, "standardizeSelectionStart", standardizeSelectionStart);
putNotNull(map, "static", staticToolbar);
// TODO relativeContainer // Toolbar is appended relative to a given DOM-Node instead of appending it to the body and position it absolute.
// map.put("relativeContainer", null);
putNotNull(map, "align", align);
putNotNull(map, "sticky", sticky);
putNotNull(map, "stickyTopOffset", stickyTopOffset);
putNotNull(map, "updateOnEmptySelection", updateOnEmptySelection);
return map;
}
示例5: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonArray array = Json.createArray();
for (KeyboardCommand c : commands) {
JsonObject map = Json.createObject();
putNotNull(map, "command", c.command);
putNotNull(map, "key", c.key);
putNotNull(map, "meta", c.meta);
putNotNull(map, "shift", c.shift);
putNotNull(map, "alt", c.alt);
array.set(array.length(), map);
}
return array;
}
示例6: encode
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue encode(final String value) {
String result;
switch (value) {
case "Finished":
result = "<div class=\"statusIconGreen\">" + FontAwesome.CHECK_CIRCLE.getHtml() + "</div>";
break;
case "Failed":
result = "<div class=\"statusIconRed\">" + FontAwesome.EXCLAMATION_CIRCLE.getHtml() + "</div>";
break;
default:
result = "<div class=\"statusIconActive\"></div>";
}
return super.encode(result);
}
示例7: getResult
import elemental.json.JsonValue; //导入依赖的package包/类
private JsonRpcResult getResult(JsonObject response) {
if (!response.hasKey("result")) {
return null;
}
JsonValue jsonValue = response.get("result");
if (!jsonValue.getType().equals(ARRAY)) {
return new JsonRpcResult(getInnerItem(jsonValue));
}
JsonArray jsonArray = (JsonArray) jsonValue;
int size = jsonArray.length();
List<Object> innerResults = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
JsonValue innerJsonElement = jsonArray.get(i);
Object innerItem = getInnerItem(innerJsonElement);
innerResults.add(innerItem);
}
return new JsonRpcResult(innerResults);
}
示例8: getParams
import elemental.json.JsonValue; //导入依赖的package包/类
private JsonRpcParams getParams(JsonObject jsonObject) {
if (!jsonObject.hasKey("params")) {
return null;
}
JsonValue jsonValue = jsonObject.get("params");
if (!jsonValue.getType().equals(ARRAY)) {
return new JsonRpcParams(getInnerItem(jsonValue));
}
JsonArray jsonArray = (JsonArray) jsonValue;
int size = jsonArray.length();
List<Object> innerParameters = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
JsonValue innerJsonElement = jsonArray.get(i);
Object innerItem = getInnerItem(innerJsonElement);
innerParameters.add(innerItem);
}
return new JsonRpcParams(innerParameters);
}
示例9: composeOne
import elemental.json.JsonValue; //导入依赖的package包/类
private <T> T composeOne(Class<T> type, Object paramObject) {
if (paramObject instanceof JsonValue) {
JsonValue jsonValue = (JsonValue) paramObject;
return dtoFactory.createDtoFromJson(jsonValue.toJson(), type);
}
return cast(paramObject);
}
示例10: getJsonValue
import elemental.json.JsonValue; //导入依赖的package包/类
private JsonValue getJsonValue(Object param) {
if (param == null) {
return jsonFactory.createNull();
}
if (param instanceof JsonValue) {
return cast(param);
}
if (param instanceof String) {
return jsonFactory.create((String) param);
}
if (param instanceof Boolean) {
return jsonFactory.create((Boolean) param);
}
if (param instanceof Double) {
return jsonFactory.create((Double) param);
}
return jsonFactory.parse(dtoFactory.toJson(param));
}
示例11: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
putNotNull(map, "hideDelay", hideDelay);
putNotNull(map, "previewValueSelector", previewValueSelector);
putNotNull(map, "showOnEmptyLinks", showOnEmptyLinks);
putNotNull(map, "showWhenToolbarIsVisible", showWhenToolbarIsVisible);
return map;
}
示例12: putNotNull
import elemental.json.JsonValue; //导入依赖的package包/类
protected void putNotNull(JsonObject obj, String key, JsonValue value) {
if (value != null) {
obj.put(key, value);
}
}
示例13: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
putNotNull(map, "forcePlainText", forcePlainText);
putNotNull(map, "cleanPastedHTML", cleanPastedHTML);
putNotNull(map, "cleanAttrs", cleanAttrs);
putNotNull(map, "cleanTags", cleanTags);
putNotNull(map, "unwrapTags", unwrapTags);
return map;
}
示例14: buildJson
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue buildJson() {
JsonObject map = Json.createObject();
putNotNull(map, "text", text);
putNotNull(map, "hideOnClick", hideOnClick);
return map;
}
示例15: encode
import elemental.json.JsonValue; //导入依赖的package包/类
@Override
public JsonValue encode(String value) {
String newValue = null;
if (value != null) {
newValue = "<img src=\"data:image/png;base64," + value + "\" alt=\"\" />";
}
return super.encode(newValue);
}