|
1 | 1 | package com.offbytwo.jenkins.model; |
2 | 2 |
|
3 | | -import com.thoughtworks.xstream.XStream; |
4 | | -import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver; |
5 | | - |
6 | 3 | public class View extends MainView { |
7 | 4 |
|
8 | 5 | private String name = ""; |
@@ -37,34 +34,48 @@ public void setUrl(String url) { |
37 | 34 | this.url = url; |
38 | 35 | } |
39 | 36 |
|
40 | | - @Override |
41 | | - public String toString() { |
42 | | - XStream xstream = new XStream(new JsonHierarchicalStreamDriver()); |
43 | | - return xstream.toXML(this); |
44 | | - } |
45 | | - |
46 | 37 | @Override |
47 | | - public boolean equals(Object o) { |
48 | | - if (this == o) return true; |
49 | | - if (o == null || getClass() != o.getClass()) return false; |
50 | | - |
51 | | - View view = (View) o; |
52 | | - |
53 | | - if (description != null ? !description.equals(view.description) : view.description != null) |
54 | | - return false; |
55 | | - if (name != null ? !name.equals(view.name) : view.name != null) |
56 | | - return false; |
57 | | - if (url != null ? !url.equals(view.url) : view.url != null) |
58 | | - return false; |
59 | | - |
60 | | - return true; |
61 | | - } |
| 38 | + public boolean equals( Object obj ) |
| 39 | + { |
| 40 | + if ( this == obj ) |
| 41 | + return true; |
| 42 | + if ( obj == null ) |
| 43 | + return false; |
| 44 | + if ( getClass() != obj.getClass() ) |
| 45 | + return false; |
| 46 | + View other = (View) obj; |
| 47 | + if ( description == null ) |
| 48 | + { |
| 49 | + if ( other.description != null ) |
| 50 | + return false; |
| 51 | + } |
| 52 | + else if ( !description.equals( other.description ) ) |
| 53 | + return false; |
| 54 | + if ( name == null ) |
| 55 | + { |
| 56 | + if ( other.name != null ) |
| 57 | + return false; |
| 58 | + } |
| 59 | + else if ( !name.equals( other.name ) ) |
| 60 | + return false; |
| 61 | + if ( url == null ) |
| 62 | + { |
| 63 | + if ( other.url != null ) |
| 64 | + return false; |
| 65 | + } |
| 66 | + else if ( !url.equals( other.url ) ) |
| 67 | + return false; |
| 68 | + return true; |
| 69 | + } |
62 | 70 |
|
63 | 71 | @Override |
64 | | - public int hashCode() { |
65 | | - int result = name != null ? name.hashCode() : 0; |
66 | | - result = 31 * result + (description != null ? description.hashCode() : 0); |
67 | | - result = 31 * result + (url != null ? url.hashCode() : 0); |
68 | | - return result; |
69 | | - } |
| 72 | + public int hashCode() |
| 73 | + { |
| 74 | + final int prime = 31; |
| 75 | + int result = 1; |
| 76 | + result = prime * result + ( ( description == null ) ? 0 : description.hashCode() ); |
| 77 | + result = prime * result + ( ( name == null ) ? 0 : name.hashCode() ); |
| 78 | + result = prime * result + ( ( url == null ) ? 0 : url.hashCode() ); |
| 79 | + return result; |
| 80 | + } |
70 | 81 | } |
0 commit comments