List of usage examples for com.google.gson JsonPrimitive JsonPrimitive
public JsonPrimitive(Character c)
From source file:com.appslandia.common.json.LocalDateTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(Jdk8DateUtils.DATETIME_FORMATTER.format(src)); }
From source file:com.appslandia.common.json.LocalTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(LocalTime src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(Jdk8DateUtils.TIME_FORMATTER.format(src)); }
From source file:com.appslandia.common.json.OffsetDateTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(OffsetDateTime src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(Jdk8DateUtils.DATETIME_FORMATTER_Z.format(src)); }
From source file:com.appslandia.common.json.OffsetTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(OffsetTime src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(Jdk8DateUtils.TIME_FORMATTER_Z.format(src)); }
From source file:com.appslandia.common.json.SqlDateAdapter.java
License:Open Source License
@Override public JsonElement serialize(java.sql.Date src, Type typeOfSrc, JsonSerializationContext context) { synchronized (this.fmtMutex) { return new JsonPrimitive(this.formatter.format(src)); }/*from w w w .j a v a 2s . c om*/ }
From source file:com.appslandia.common.json.SqlDateTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(java.sql.Timestamp src, Type typeOfSrc, JsonSerializationContext context) { synchronized (this.fmtMutex) { return new JsonPrimitive(this.formatter.format(src)); }// www . jav a 2 s.c o m }
From source file:com.appslandia.common.json.SqlTimeAdapter.java
License:Open Source License
@Override public JsonElement serialize(java.sql.Time src, Type typeOfSrc, JsonSerializationContext context) { synchronized (this.fmtMutex) { return new JsonPrimitive(this.formatter.format(src)); }//from ww w . j a v a2 s .c o m }
From source file:com.arcbees.vcs.util.CommitStatusTypeAdapter.java
License:Apache License
@Override public JsonElement serialize(CommitStatus src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.getStatusCode()); }
From source file:com.asakusafw.lang.inspection.json.NodeAdapter.java
License:Apache License
@Override public JsonElement serialize(InspectionNode src, Type typeOfSrc, JsonSerializationContext context) { JsonObject result = new JsonObject(); result.add(KEY_ID, new JsonPrimitive(src.getId())); result.add(KEY_TITLE, new JsonPrimitive(src.getTitle())); result.add(KEY_INPUTS, context.serialize(extract(src.getInputs()), TYPE_PORTS)); result.add(KEY_OUTPUTS, context.serialize(extract(src.getOutputs()), TYPE_PORTS)); result.add(KEY_PROPERTIES, context.serialize(src.getProperties(), TYPE_PROPERTIES)); result.add(KEY_ELEMENTS, context.serialize(extract(src.getElements()), TYPE_NODES)); return result; }
From source file:com.asakusafw.lang.inspection.json.PortAdapter.java
License:Apache License
@Override public JsonElement serialize(InspectionNode.Port src, Type typeOfSrc, JsonSerializationContext context) { JsonObject result = new JsonObject(); result.add(KEY_ID, new JsonPrimitive(src.getId())); result.add(KEY_PROPERTIES, context.serialize(src.getProperties(), TYPE_PROPERTIES)); result.add(KEY_OPPOSITES, context.serialize(src.getOpposites(), TYPE_REFERENCES)); return result; }