Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package pt.estgp.estgweb.utils.documentBuilder;
import com.owlike.genson.Genson;
import com.owlike.genson.GensonBuilder;
import org.json.JSONException;
import org.json.JSONObject;
import pt.estgp.estgweb.domain.utils.JsonView;
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.ReportCourseDocument;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by jorgemachado on 31/10/17.
*/
public class 5+0%2Fdocs%2Fapi+Document">Document implements JsonView
{
List
<DocumentSection
> sections =
new ArrayList
<DocumentSection
>();
public List
<DocumentSection
> getSections
() {
return sections
;
}
public void setSections
(List
<DocumentSection
> sections
) {
this.
sections = sections
;
}
private static Genson gensonGenericLoad
;
static{
gensonGenericLoad =
new GensonBuilder
()
.
useMethods(true)
.
useFields(true)
.
useRuntimeType(true)
.
useClassMetadata(true)
.
useDateAsTimestamp(true)
.
exclude(5+0%2Fdocs%2Fapi+Date">Date.
class)
.
exclude(java.
sql.
5+0%2Fdocs%2Fapi+Timestamp">Timestamp.
class)
.
exclude(java.
sql.
5+0%2Fdocs%2Fapi+Date">Date.
class)
.
create();
}
public static ReportCourseDocument fromJson
(1.5.0/docs/api/java/lang/String.html">String json
)
{
return gensonGenericLoad.
deserialize(json,ReportCourseDocument.
class);
}
public List
<String
> getJsonExcludedProperties
() {
return null;
}
/**
* Generic Json Object only for local class methods
* @return
* @throws org.json.JSONException
*/
public JSONObject toJsonObject
() throws JSONException
{
return new JSONObject
(toJson
());
}
/**
* * Generic Json Object only for local class methods
* @return
* @throws java.io.IOException
*/
public 1.5.0/docs/api/java/lang/String.html">String toJson
()
{
return gensonGenericLoad.
serialize(this);
}
}