commit d92e45ecccc497ca51aee91373a70d0e292b5a7d Author: Erik C. Thauvin Date: Fri Aug 12 11:54:32 2016 -0700 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24f188e --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +**/.idea/dictionaries +**/.idea/gradle.xml +**/.idea/libraries +**/.idea/tasks.xml +**/.idea/workspace.xml +*.iws +.DS_Store +.classpath +.gradle +.kobalt +.nb-gradle +.project +.settings +/bin +/build +/deploy +/dist +/gen +/gradle.properties +/local.properties +/out +/proguard-project.txt +/project.properties +/target +/test-output +Thumbs.db +ehthumbs.db +kobaltBuild \ No newline at end of file diff --git a/gson-test.iml b/gson-test.iml new file mode 100644 index 0000000..69a5a30 --- /dev/null +++ b/gson-test.iml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gson-test.ipr b/gson-test.ipr new file mode 100644 index 0000000..ce9f827 --- /dev/null +++ b/gson-test.ipr @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Android Lint + + + Java + + + Portability issuesJava + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.8.x + + + + + + + + \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml new file mode 100644 index 0000000..ee86435 --- /dev/null +++ b/kobalt/Build.kt.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt new file mode 100644 index 0000000..81b6565 --- /dev/null +++ b/kobalt/src/Build.kt @@ -0,0 +1,43 @@ +import com.beust.kobalt.* +import com.beust.kobalt.plugin.packaging.* +import com.beust.kobalt.plugin.application.* +import com.beust.kobalt.plugin.kotlin.* + +val repos = repos() + + +val p = project { + + name = "gson-test" + group = "com.example" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/kotlin") + } + + sourceDirectoriesTest { + path("src/test/kotlin") + } + + dependencies { + compile("com.google.code.gson:gson:2.7") + } + + dependenciesTest { + compile("org.testng:testng:") + + } + + assemble { + jar { + } + } + + application { + mainClass = "com.example.MainKt" + } + + +} diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000..7c076e6 Binary files /dev/null and b/kobalt/wrapper/kobalt-wrapper.jar differ diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 0000000..872a862 --- /dev/null +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.898 \ No newline at end of file diff --git a/kobaltw b/kobaltw new file mode 100644 index 0000000..c5186d5 --- /dev/null +++ b/kobaltw @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +java -jar "`dirname "$0"`/kobalt/wrapper/kobalt-wrapper.jar" $* diff --git a/kobaltw.bat b/kobaltw.bat new file mode 100644 index 0000000..d578071 --- /dev/null +++ b/kobaltw.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %* diff --git a/lib/kotlin-reflect.jar b/lib/kotlin-reflect.jar new file mode 100644 index 0000000..62340e2 Binary files /dev/null and b/lib/kotlin-reflect.jar differ diff --git a/lib/kotlin-runtime-sources.jar b/lib/kotlin-runtime-sources.jar new file mode 100644 index 0000000..e661b30 Binary files /dev/null and b/lib/kotlin-runtime-sources.jar differ diff --git a/lib/kotlin-runtime.jar b/lib/kotlin-runtime.jar new file mode 100644 index 0000000..4d7a927 Binary files /dev/null and b/lib/kotlin-runtime.jar differ diff --git a/libs/gson-test-0.1.jar b/libs/gson-test-0.1.jar new file mode 100644 index 0000000..7a79574 Binary files /dev/null and b/libs/gson-test-0.1.jar differ diff --git a/src/main/kotlin/com/example/Main.kt b/src/main/kotlin/com/example/Main.kt new file mode 100644 index 0000000..fab4595 --- /dev/null +++ b/src/main/kotlin/com/example/Main.kt @@ -0,0 +1,17 @@ +package com.example + +import com.example.models.ConfigObject +import com.example.models.Container +import com.google.gson.Gson + +fun main(args: Array) { + var json = "{ nodes: [ { item1: 'value1a', item2: 'value2a' }, { item1: 'value1b', item2: 'value2b' }, { item1: 'value1c', item2: 'value2c' } ] } " + + val gson = Gson() + val container: Container = gson.fromJson(json, Container::class.java) + println(container) + + json = "{ \"name\": \"DKS 1802-EPD\", \"star\": \"*\", \"hash\": \"#\", \"master\": 4, \"opts\": [ { \"title\": \"Delete 4-Digit Entry Code\", \"fields\": [ { \"hint\": \"Entry Code\", \"alpha\": false, \"max\": 4 } ], \"dial\": \"*14[MASTER],[FIELD:1]*\" }, { \"title\": \"Add 4-Digit Entry Code\", \"fields\": [ { \"hint\": \"Entry Code\", \"alpha\": false, \"max\": 4 } ], \"dial\": \"*02[MASTER],[FIELD:1]*\" }, { \"title\": \"Add Name\", \"fields\": [ { \"hint\": \"Directory Code\", \"alpha\": false, \"max\": 3 }, { \"hint\": \"Name\", \"alpha\": true, \"max\": 11 } ], \"dial\": \"*66[MASTER],[FIELD:1]*,[FIELD:2]*\" }, { \"title\": \"Add 7-digit Phone Number\", \"fields\": [ { \"hint\": \"Directory Code\", \"alpha\": false, \"max\": 3 }, { \"hint\": \"Phone Number\", \"alpha\": true, \"max\": 7 } ], \"dial\": \"*01[MASTER],[FIELD:1]*,[FIELD:2]*\" }, { \"title\": \"Set Time Clock\", \"fields\": [ { \"hint\": \"Hour & Minutes\", \"alpha\": false, \"max\": 4 }, { \"hint\": \"AM=0 PM=1\", \"alpha\": false, \"max\": 1 }, { \"hint\": \"Month\", \"alpha\": false, \"max\": 2 }, { \"hint\": \"Day of Month\", \"alpha\": false, \"max\": 2 }, { \"hint\": \"Year\", \"alpha\": false, \"max\": 2 }, { \"hint\": \"Day of Week (Sun=1, Mon=2..)\", \"alpha\": false, \"max\": 1 } ], \"dial\": \"*33[MASTER],[FIELD:1]*,[FIELD:2]*,[FIELD:3]*,[FIELD:4]*,[FIELD:5]*,[FILED:6]*\" } ] }" + val config : ConfigObject = gson.fromJson(json, ConfigObject::class.java) + println(config) +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/models/ConfigObject.kt b/src/main/kotlin/com/example/models/ConfigObject.kt new file mode 100644 index 0000000..831b7d5 --- /dev/null +++ b/src/main/kotlin/com/example/models/ConfigObject.kt @@ -0,0 +1,20 @@ +package com.example.models + +/** + * The ConfigObject class. + * + * @author Erik C. Thauvin + * @created 2016-08-11 + * @since 1.0 + */ +class ConfigObject { + var name: String = "" + var star: String = "" + var hash: String = "" + var master: Int = 0 + var opts: List = emptyList() + + override fun toString(): String { + return "Config [name=$name, star=$star, hash=$hash, master=$master, opts=$opts]" + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/models/Container.kt b/src/main/kotlin/com/example/models/Container.kt new file mode 100644 index 0000000..4979d53 --- /dev/null +++ b/src/main/kotlin/com/example/models/Container.kt @@ -0,0 +1,16 @@ +package com.example.models + +/** + * The Container class. + * + * @author Erik C. Thauvin + * @created 2016-08-12 + * @since 1.0 + */ +class Container { + val nodes : List = emptyList() + + override fun toString(): String { + return "Nodes [nodes=$nodes]" + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/models/FieldObject.kt b/src/main/kotlin/com/example/models/FieldObject.kt new file mode 100644 index 0000000..20a001c --- /dev/null +++ b/src/main/kotlin/com/example/models/FieldObject.kt @@ -0,0 +1,18 @@ +package com.example.models + +/** + * The FieldObject class. + * + * @author Erik C. Thauvin + * @created 2016-08-11 + * @since 1.0 + */ +class FieldObject { + var hint: String = "" + var alpha: Boolean = false + var max: Int = 0 + + override fun toString(): String { + return "Field [hint=$hint, alpha=$alpha, max=$max]" + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/models/Node.kt b/src/main/kotlin/com/example/models/Node.kt new file mode 100644 index 0000000..025fccc --- /dev/null +++ b/src/main/kotlin/com/example/models/Node.kt @@ -0,0 +1,17 @@ +package com.example.models + +/** + * The Node class. + * + * @author Erik C. Thauvin + * @created 2016-08-12 + * @since 1.0 + */ +class Node { + var item1: String = "" + var item2: String = "" + + override fun toString() : String { + return "Node [item1=$item1, item2=$item2]" + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/models/OptionObject.kt b/src/main/kotlin/com/example/models/OptionObject.kt new file mode 100644 index 0000000..a0a21b7 --- /dev/null +++ b/src/main/kotlin/com/example/models/OptionObject.kt @@ -0,0 +1,18 @@ +package com.example.models + +/** + * The OptionObject class. + * + * @author Erik C. Thauvin + * @created 2016-08-11 + * @since 1.0 + */ +class OptionObject { + var title: String = "" + var fields: List = emptyList() + var dial: String = "" + + override fun toString(): String { + return "Option [title=$title, fields=$fields, dial=$dial]" + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/example/MainTest.kt b/src/test/kotlin/com/example/MainTest.kt new file mode 100644 index 0000000..96458e9 --- /dev/null +++ b/src/test/kotlin/com/example/MainTest.kt @@ -0,0 +1,8 @@ +package com.example + +import org.testng.annotations.Test + +class ExampleTest { + @Test + fun f() = println("Running test") +} \ No newline at end of file