作者:手机用户2502900723 | 来源:互联网 | 2023-09-18 14:58
本文整理了Java中org.activityinfo.model.form.FormField.fromJson()
方法的一些代码示例,展示了FormField.fromJson()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FormField.fromJson()
方法的具体详情如下:
包路径:org.activityinfo.model.form.FormField
类名称:FormField
方法名:fromJson
暂无
代码示例
代码示例来源:origin: bedatadriven/activityinfo
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
this.value = FormField.fromJson((JsonValue)new JsonParser().parse(in.readUTF()));
}
}
代码示例来源:origin: bedatadriven/activityinfo
private static FormElement elementFromJson(JsonValue elementObject) {
JsonValue typeElement = elementObject.get("type");
if(typeElement.isJsonPrimitive()) {
String type = typeElement.asString();
if ("section".equals(type)) {
return FormSection.fromJson(elementObject);
} else if ("label".equals(type)) {
return FormLabel.fromJson(elementObject);
}
}
return FormField.fromJson(elementObject);
}
代码示例来源:origin: bedatadriven/activityinfo
@Test
public void serialization() {
FormField field = new FormField(ResourceId.generateId());
field.setType(new CalculatedFieldType("A+B"));
JsonValue record = field.toJsonObject();
System.out.println(record.toJson());
FormField read = FormField.fromJson(record);
assertThat(read.getType(), instanceOf(CalculatedFieldType.class));
CalculatedFieldType readType = (CalculatedFieldType) read.getType();
assertThat(readType.getExpression(), equalTo("A+B"));
}
代码示例来源:origin: bedatadriven/activityinfo
@Test
public void emptySerialization() {
FormField field = new FormField(ResourceId.generateId());
field.setType(new CalculatedFieldType());
JsonValue record = field.toJsonObject();
System.out.println(record.toJson());
FormField read = FormField.fromJson(record);
assertThat(read.getType(), instanceOf(CalculatedFieldType.class));
CalculatedFieldType readType = (CalculatedFieldType) read.getType();
assertThat(readType.getExpression(), nullValue());
}
}