Link.java
2.63 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.json.JSONException
* org.json.JSONObject
*/
package com.adobe.reef.siren;
import java.util.Arrays;
import org.json.JSONException;
import org.json.JSONObject;
public final class Link {
private String[] rel;
private String href;
private String title;
private String type;
public Link(String[] rel, String href) throws IllegalArgumentException {
if (rel == null || rel.length == 0 || href == null || href.isEmpty()) {
throw new IllegalArgumentException("rel and href can not be null or empty");
}
this.rel = rel;
this.href = href;
}
public String[] getRel() {
return this.rel;
}
public void setRel(String[] rel) {
this.rel = rel;
}
public String getHref() {
return this.href;
}
public void setHref(String href) {
if (href == null || href.isEmpty()) {
throw new IllegalArgumentException("href can not be null or empty.");
}
this.href = href;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String toString() {
try {
JSONObject link = new JSONObject();
link.put("rel", (Object)this.rel);
link.put("href", (Object)this.href);
if (this.title != null) {
link.put("title", (Object)this.title);
}
if (this.type != null) {
link.put("type", (Object)this.type);
}
return link.toString();
}
catch (JSONException e) {
throw new RuntimeException((Throwable)e);
}
}
public int hashCode() {
int prime = 31;
int result = 1;
result = 31 * result + (this.href == null ? 0 : this.href.hashCode());
result = 31 * result + Arrays.hashCode(this.rel);
return result;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
Link other = (Link)obj;
if (this.href == null ? other.href != null : !this.href.equals(other.href)) {
return false;
}
if (!Arrays.equals(this.rel, other.rel)) {
return false;
}
return true;
}
}