-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix for List analysis with annotations. Fixing binder validation.
- Loading branch information
Showing
15 changed files
with
77 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name := "DSL-JSON Scala example" | ||
version := "2.0.1" | ||
version := "2.0.2" | ||
organization := "com.dslplatform.json.example" | ||
scalaVersion := "2.13.11" | ||
|
||
ThisBuild / useCoursier := false | ||
resolvers += Resolver.mavenLocal | ||
|
||
libraryDependencies += "com.dslplatform" %% "dsl-json-scala" % "2.0.1" | ||
libraryDependencies += "com.dslplatform" %% "dsl-json-scala" % "2.0.2" | ||
libraryDependencies += "javax.json.bind" % "javax.json.bind-api" % "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests-java8/src/test/java/com/dslplatform/json/MutablePerson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.dslplatform.json; | ||
|
||
import java.io.IOException; | ||
|
||
@CompiledJson | ||
public class MutablePerson { | ||
|
||
public static class Name { | ||
private String value; | ||
public String value() { return value; } | ||
public static Name create(String value) { | ||
Name fn = new Name(); | ||
fn.value = value; | ||
return fn; | ||
} | ||
|
||
//When creating wrapper classes, we can "abuse" them and make them "locally mutable" | ||
//so when deserializing instance we can just change the values instead of allocate even more objects | ||
@JsonConverter(target = Name.class) | ||
public static class NameConverter { | ||
public static void write(JsonWriter writer, Name instance) { | ||
writer.writeString(instance.value); | ||
} | ||
public static Name read(JsonReader reader) throws IOException { | ||
return Name.create(reader.readString()); | ||
} | ||
|
||
public static Name bind(JsonReader reader, Name instance) throws IOException { | ||
if (instance == null) instance = new Name(); | ||
instance.value = reader.readString(); | ||
return instance; | ||
} | ||
} | ||
} | ||
|
||
public Name firstname; | ||
public Name surname; | ||
public int age; | ||
} |