64 lines
1.7 KiB
Java
64 lines
1.7 KiB
Java
/*
|
|
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
* in compliance with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
* the License.
|
|
*/
|
|
package monasca.api.domain.model.common;
|
|
|
|
public class Link {
|
|
public String rel;
|
|
|
|
public String href;
|
|
|
|
public Link() {}
|
|
|
|
public Link(String rel, String href) {
|
|
this.rel = rel;
|
|
this.href = href;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj) {
|
|
if (this == obj)
|
|
return true;
|
|
if (obj == null)
|
|
return false;
|
|
if (getClass() != obj.getClass())
|
|
return false;
|
|
Link other = (Link) obj;
|
|
if (href == null) {
|
|
if (other.href != null)
|
|
return false;
|
|
} else if (!href.equals(other.href))
|
|
return false;
|
|
if (rel == null) {
|
|
if (other.rel != null)
|
|
return false;
|
|
} else if (!rel.equals(other.rel))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
final int prime = 31;
|
|
int result = 1;
|
|
result = prime * result + ((href == null) ? 0 : href.hashCode());
|
|
result = prime * result + ((rel == null) ? 0 : rel.hashCode());
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.format("Link [rel=%s, href=%s]", rel, href);
|
|
}
|
|
}
|