Subversion Repositories bacoAlunos

Rev

Rev 1929 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1929 Rev 1930
Line 13... Line 13...
13
/**
13
/**
14
 * Created by jorgemachado on 07/11/17.
14
 * Created by jorgemachado on 07/11/17.
15
 */
15
 */
16
public class ExtensibleDocObject
16
public class ExtensibleDocObject
17
{
17
{
18
    private static Genson gensonGenericLoad;
-
 
19
 
18
 
-
 
19
 
-
 
20
 
-
 
21
    private static Genson gensonGenericLoad;
20
    static{
22
    static{
21
        gensonGenericLoad = new GensonBuilder()
23
        gensonGenericLoad = new GensonBuilder()
22
                        .useMethods(true)
24
                .useMethods(true)
23
                        .useFields(true)
25
                .useFields(true)
24
                        .useRuntimeType(true) //para ignorar a CGLIB do courseUnitEvaluation
26
                .useRuntimeType(true) //para ignorar a CGLIB do courseUnitEvaluation
25
                        .useClassMetadata(true)
27
                .useClassMetadata(true)
26
                        .useDateAsTimestamp(true)
28
                .useDateAsTimestamp(true)
27
                        .exclude(1.5.0/docs/api/java/lang/Class.html">Class.class)
29
                .exclude(1.5.0/docs/api/java/lang/Class.html">Class.class)
28
                        .exclude(5+0%2Fdocs%2Fapi+Date">Date.class)
30
                .exclude(5+0%2Fdocs%2Fapi+Date">Date.class)
29
                        .exclude(java.sql.5+0%2Fdocs%2Fapi+Timestamp">Timestamp.class)
31
                .exclude(java.sql.5+0%2Fdocs%2Fapi+Timestamp">Timestamp.class)
30
                        .exclude(java.sql.5+0%2Fdocs%2Fapi+Date">Date.class)
32
                .exclude(java.sql.5+0%2Fdocs%2Fapi+Date">Date.class)
31
                        .create();
33
                .create();
32
    }
34
    }
33
 
35
 
34
    public static CourseReportDocument fromJson(1.5.0/docs/api/java/lang/String.html">String json)
36
    public static CourseReportDocument fromJson(1.5.0/docs/api/java/lang/String.html">String json)
35
    {
37
    {
36
        return gensonGenericLoad.deserialize(json,CourseReportDocument.class);
38
        return gensonGenericLoad.deserialize(json,CourseReportDocument.class);
37
    }
39
    }
-
 
40
 
-
 
41
 
-
 
42
 
38
            /**
43
    /**
39
             * Generic Json Object only for local class methods
44
     * Generic Json Object only for local class methods
40
             * @return
45
     * @return
41
             * @throws JSONException
46
     * @throws JSONException
42
             */
47
     */
43
    public JSONObject toJsonObject() throws JSONException
48
    public JSONObject toJsonObject() throws JSONException
44
    {
49
    {
45
        return new JSONObject(toJson());
50
        return new JSONObject(toJson());
46
    }
51
    }
-
 
52
 
47
            /**
53
    /**
48
             * * Generic Json Object only for local class methods
54
     * * Generic Json Object only for local class methods
49
             * @return
55
     * @return
50
             * @throws java.io.IOException
56
     * @throws java.io.IOException
51
             */
57
     */
52
    public 1.5.0/docs/api/java/lang/String.html">String toJson()
58
    public 1.5.0/docs/api/java/lang/String.html">String toJson()
53
    {
59
    {
54
        return gensonGenericLoad.serialize(this);
60
        return gensonGenericLoad.serialize(this);
55
    }
61
    }
56
 
62
 
-
 
63
 
57
    public List<String> getAllSuperClasses()
64
    public List<String> getAllSuperClasses()
58
    {
65
    {
59
        return ClassUtils.getAllSuperClasses(this.getClass());
66
        return ClassUtils.getAllSuperClasses(this.getClass());
60
    }
67
    }
61
 
-
 
62
    public void setAllSuperClasses(List<String> superclasses)
68
    public void setAllSuperClasses(List<String> superclasses)
63
    {
69
    {
64
 
70
 
65
    }
71
    }
66
 
72
 
-
 
73
 
67
}
74
}
68
 
75