-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
surfacelinename and surfacelinecode gson deserializer
- Loading branch information
Showing
6 changed files
with
76 additions
and
11 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
24 changes: 24 additions & 0 deletions
24
library/src/main/java/nl/endevelopment/r2randroid/r2rlib/parser/SurfaceLineCodeParser.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,24 @@ | ||
package nl.endevelopment.r2randroid.r2rlib.parser; | ||
|
||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonParseException; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
import nl.endevelopment.r2randroid.r2rlib.models.SurfaceLineCode; | ||
|
||
/** | ||
* Created by jan on 28/08/2017. | ||
*/ | ||
|
||
public class SurfaceLineCodeParser implements JsonDeserializer<SurfaceLineCode> { | ||
@Override | ||
public SurfaceLineCode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | ||
|
||
String code = json.getAsString(); | ||
|
||
return new SurfaceLineCode(code); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
library/src/main/java/nl/endevelopment/r2randroid/r2rlib/parser/SurfaceLineNameParser.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,25 @@ | ||
package nl.endevelopment.r2randroid.r2rlib.parser; | ||
|
||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonParseException; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
import nl.endevelopment.r2randroid.r2rlib.models.SurfaceLineCode; | ||
import nl.endevelopment.r2randroid.r2rlib.models.SurfaceLineName; | ||
|
||
/** | ||
* Created by jan on 28/08/2017. | ||
*/ | ||
|
||
public class SurfaceLineNameParser implements JsonDeserializer<SurfaceLineName> { | ||
@Override | ||
public SurfaceLineName deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | ||
|
||
String name = json.getAsString(); | ||
|
||
return new SurfaceLineName(name); | ||
} | ||
} |
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