edvin
04/14/2017, 3:23 PMconfig
object supports JsonObject
, JsonArray
and JsonModel
. You set them using config.set("key" to value)
and retrieve them using config.jsonObject("key")
, config.jsonArray("key")
and config.jsonModel("key")
.edvin
04/14/2017, 3:23 PMron
04/14/2017, 3:23 PMedvin
04/14/2017, 3:23 PMedvin
04/14/2017, 3:24 PMron
04/14/2017, 3:25 PMron
04/14/2017, 3:26 PMedvin
04/14/2017, 3:27 PMconfig
I guess? It should be pretty easy to do however, if you let your domain objects implement JsonModel, you get it almost for free.ron
04/14/2017, 3:28 PMalmost free
🙂ron
04/14/2017, 3:28 PMron
04/14/2017, 3:28 PMedvin
04/14/2017, 3:29 PMedvin
04/14/2017, 3:30 PMloadJsonObject()
.edvin
04/14/2017, 3:30 PMinputStream
, path
and url
.ron
04/14/2017, 3:32 PMedvin
04/14/2017, 3:32 PMron
04/14/2017, 3:32 PM{
"name": "top",
"dropAllowed": true,
"children": [
{
"name": "child 1",
"dropAllowed": true,
"children": [
{
"name": "child 1.1",
"dropAllowed": true
}
]
},
{
"name": "child 2",
"dropAllowed": true
}
]
}
edvin
04/14/2017, 3:33 PMedvin
04/14/2017, 3:34 PMedvin
04/14/2017, 3:34 PMron
04/14/2017, 3:35 PMron
04/14/2017, 3:35 PMron
04/14/2017, 3:36 PMedvin
04/14/2017, 3:36 PMJsonStructure.save()
.edvin
04/14/2017, 3:36 PMOutputStream
, URL
and Path
.edvin
04/14/2017, 3:36 PMron
04/14/2017, 3:50 PMron
04/14/2017, 3:53 PMjava.lang.NullPointerException
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:41)
at tornadofx.JsonModel$DefaultImpls.toJSON(Json.kt:49)
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:14)
at tornadofx.JsonKt.toJSON(Json.kt:364)
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:41)
at tornadofx.JsonModel$DefaultImpls.toJSON(Json.kt:49)
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:14)
at tornadofx.JsonKt.toJSON(Json.kt:364)
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:41)
at tornadofx.JsonModel$DefaultImpls.toJSON(Json.kt:49)
at nl.codetribe.model.PhotoCategory.toJSON(PhotoCategory.kt:14)
at nl.codetribe.model.PhotoCategoryTest.testCategories(PhotoCategoryTest.kt:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Process finished with exit code 255
ron
04/14/2017, 3:59 PM