code_junkie

Transforming Point object when using simple-xml

Nov 13th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public class PointTransform implements Transform<Point> {
  2.  
  3. public Point read(String value) {
  4. return fromString(value);
  5. }
  6.  
  7. public String write(Point value) {
  8. return toString(value);
  9. }
  10.  
  11. // etc ...
  12. }
  13.  
  14. @Root
  15. public class Point {
  16.  
  17. @Attribute
  18. private int x;
  19.  
  20. @Attribute
  21. private int y;
  22.  
  23. public int getX() {
  24. return x;
  25. }
  26.  
  27. public int getY() {
  28. return y;
  29. }
  30. }
Add Comment
Please, Sign In to add comment