File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
lib/src/main/kotlin/dbSave/jsonFormat Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,14 @@ import com.google.common.reflect.TypeToken
44import com.google.gson.GsonBuilder
55import java.io.File
66
7- class JsonRepository < Pack : Comparable < Pack >> (private val dirPath : String ) {
7+ class JsonRepository (private val dirPath : String ) {
88
99 init {
1010 File (dirPath).mkdirs()
1111 }
1212
13- fun saveChanges (
13+ fun < Pack : Comparable < Pack >> saveChanges (
1414 preOrder : Array <DrawBINVertex <Pack >>,
15- typeToken : TypeToken <Array <DrawBINVertex <Pack >>>,
1615 fileName : String
1716 ) {
1817
@@ -24,13 +23,13 @@ class JsonRepository<Pack : Comparable<Pack>>(private val dirPath: String) {
2423 writeText(json)
2524 }
2625
27- val preOrd = gson.fromJson<Array <DrawBINVertex <Pack >>>(json, typeToken.type)
28-
2926 }
3027
31- fun exportTree (fileName : String ) {
28+ fun < Pack : Comparable < Pack >> exportTree (fileName : String , typeToken : TypeToken < Array < DrawBINVertex < Pack >>> ) {
3229 val gson = GsonBuilder ().setPrettyPrinting().create()
33- // val json = gson.fromJson(File(dirPath, fileName).readText(), ArrayVertices::class.java)
30+ val json = File (dirPath, fileName).readText()
31+
32+ val preOrd = gson.fromJson<Array <DrawBINVertex <Pack >>>(json, typeToken.type)
3433
3534
3635 }
You can’t perform that action at this time.
0 commit comments