Rev 1814 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1814 | jmachado | 1 | package pt.estgp.estgweb.domain.typesgen.controloatividadedocente; |
1653 | jmachado | 2 | |
3 | import com.owlike.genson.Genson; |
||
1827 | jmachado | 4 | import com.owlike.genson.GensonBuilder; |
1653 | jmachado | 5 | import org.apache.log4j.Logger; |
1814 | jmachado | 6 | import pt.estgp.estgweb.domain.typesgen.BacoDataAbstractType; |
1653 | jmachado | 7 | |
8 | import java.util.ArrayList; |
||
9 | |||
10 | /** |
||
11 | * Created by jorgemachado on 03/02/17. |
||
12 | */ |
||
1670 | jmachado | 13 | public class EsquemaPontos extends BacoDataAbstractType |
1653 | jmachado | 14 | { |
15 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(EsquemaPontos.class); |
||
16 | ArrayList<AtividadePontuada> atividades; |
||
17 | |||
18 | public ArrayList<AtividadePontuada> getAtividades() { |
||
19 | return atividades; |
||
20 | } |
||
21 | |||
22 | public void setAtividades(ArrayList<AtividadePontuada> atividades) { |
||
23 | this.atividades = atividades; |
||
24 | } |
||
25 | |||
1827 | jmachado | 26 | static Genson genson = new GensonBuilder() |
1778 | jmachado | 27 | .include(1.5.0/docs/api/java/lang/Boolean.html">Boolean.class) |
28 | .include(1.5.0/docs/api/java/lang/Integer.html">Integer.class) |
||
29 | .include(1.5.0/docs/api/java/lang/Long.html">Long.class) |
||
30 | .include(1.5.0/docs/api/java/lang/Double.html">Double.class) |
||
31 | .include(1.5.0/docs/api/java/lang/Float.html">Float.class) |
||
1653 | jmachado | 32 | .include(EsquemaPontos.class) |
33 | .include(AtividadePontuada.class) |
||
34 | .create(); |
||
35 | |||
36 | public 1.5.0/docs/api/java/lang/String.html">String toString() |
||
37 | { |
||
38 | try { |
||
39 | return genson.serialize(this); |
||
40 | } catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) { |
||
41 | logger.error(e, e); |
||
42 | } |
||
43 | return ""; |
||
44 | } |
||
45 | |||
46 | public static EsquemaPontos fromString(1.5.0/docs/api/java/lang/String.html">String json) |
||
47 | { |
||
48 | try { |
||
49 | return genson.deserialize(json, EsquemaPontos.class); |
||
50 | } catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) { |
||
51 | logger.error(e,e); |
||
52 | } |
||
53 | return null; |
||
54 | } |
||
55 | |||
56 | @1.5.0/docs/api/java/lang/Override.html">Override |
||
57 | public boolean equals(5+0%2Fdocs%2Fapi+Object">Object o) { |
||
58 | if (this == o) return true; |
||
59 | if (o == null || getClass() != o.getClass()) return false; |
||
60 | |||
61 | EsquemaPontos that = (EsquemaPontos) o; |
||
62 | |||
63 | if (atividades != null ? !atividades.equals(that.atividades) : that.atividades != null) return false; |
||
64 | |||
65 | return true; |
||
66 | } |
||
67 | |||
68 | @1.5.0/docs/api/java/lang/Override.html">Override |
||
69 | public int hashCode() { |
||
70 | return atividades != null ? atividades.hashCode() : 0; |
||
71 | } |
||
72 | } |