-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.java
53 lines (45 loc) · 1.02 KB
/
Point.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlAdapter;
@XmlRootElement
public class Point {
@XmlTransient
public int x, y;
public Point() {
this(0, 0);
}
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
}
// class MyPointAdapter extends XmlAdapter<Point, java.awt.Point> {
//
// /*
// * Java => XML
// */
// public Point marshal(java.awt.Point val) throws Exception {
// return new Point((int) val.getX(), (int) val.getY());
// }
//
// /*
// * XML => Java
// */
// public java.awt.Point unmarshal(Point val) throws Exception {
// return new java.awt.Point(val.getX(), val.getY());
// }
//
//}