View Javadoc
1   package org.duniter.core.client.model.bma;
2   
3   /*
4    * #%L
5    * UCoin Java :: Core Client API
6    * %%
7    * Copyright (C) 2014 - 2016 EIS
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the 
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public 
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import com.fasterxml.jackson.annotation.JsonGetter;
26  import com.fasterxml.jackson.annotation.JsonIgnore;
27  import com.fasterxml.jackson.annotation.JsonSetter;
28  
29  import java.io.Serializable;
30  
31  /**
32   * Created by eis on 05/02/15.
33   */
34  public class NetworkPeers implements Serializable {
35  
36      public Peer[] peers;
37  
38      public String toString() {
39          String s = "";
40          for(Peer peer : peers) {
41              s += peer.toString() + "\n";
42          }
43          return s;
44      }
45  
46      public static class Peer implements Serializable {
47          public String version;
48          public String currency;
49          public String status;
50          public Long statusTS;
51          public String block;
52          public String signature;
53          public String pubkey;
54          public Long firstDown;
55          public Long lastTry;
56          public String raw;
57          public NetworkPeering.Endpoint[] endpoints;
58  
59          public String getVersion() {
60              return version;
61          }
62  
63          public void setVersion(String version) {
64              this.version = version;
65          }
66  
67          public String getCurrency() {
68              return currency;
69          }
70  
71          public void setCurrency(String currency) {
72              this.currency = currency;
73          }
74  
75          public String getStatus() {
76              return status;
77          }
78  
79          public void setStatus(String status) {
80              this.status = status;
81          }
82  
83          @JsonGetter("statusTS")
84          public Long getStatusTS() {
85              return statusTS;
86          }
87  
88          @JsonSetter("statusTS")
89          public void setStatusTS(Long statusTS) {
90              this.statusTS = statusTS;
91          }
92  
93          public String getBlock() {
94              return block;
95          }
96  
97          public void setBlock(String block) {
98              this.block = block;
99          }
100 
101         public String getSignature() {
102             return signature;
103         }
104 
105         public void setSignature(String signature) {
106             this.signature = signature;
107         }
108 
109         public String getPubkey() {
110             return pubkey;
111         }
112 
113         public void setPubkey(String pubkey) {
114             this.pubkey = pubkey;
115         }
116 
117         @JsonGetter("first_down")
118         public Long getFirstDown() {
119             return firstDown;
120         }
121 
122         @JsonSetter("first_down")
123         public void setFirstDown(Long firstDown) {
124             this.firstDown = firstDown;
125         }
126 
127         @JsonGetter("last_try")
128         public Long getLastTry() {
129             return lastTry;
130         }
131 
132         @JsonSetter("last_try")
133         public void setLastTry(Long lastTry) {
134             this.lastTry = lastTry;
135         }
136 
137         public NetworkPeering.Endpoint[] getEndpoints() {
138             return endpoints;
139         }
140 
141         public void setEndpoints(NetworkPeering.Endpoint[] endpoints) {
142             this.endpoints = endpoints;
143         }
144 
145         @JsonIgnore
146         public String getRaw() {
147             return raw;
148         }
149 
150         public void setRaw(String raw) {
151             this.raw = raw;
152         }
153 
154         @Override
155         public String toString() {
156             String s = "version=" + version + "\n" +
157                     "currency=" + currency + "\n" +
158                     "pubkey=" + pubkey + "\n" +
159                     "status=" + status + "\n" +
160                     "block=" + block + "\n";
161             for(NetworkPeering.Endpoint endpoint: endpoints) {
162                 if (endpoint != null) {
163                     s += endpoint.toString() + "\n";
164                 }
165             }
166             return s;
167         }
168     }
169 }