001/* 002 * Copyright 2015 DuraSpace, Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.fcrepo.http.commons.webxml.bind; 017 018import javax.xml.bind.annotation.XmlAccessType; 019import javax.xml.bind.annotation.XmlAccessorType; 020import javax.xml.bind.annotation.XmlElement; 021 022/** 023 * <p>Param class.</p> 024 * 025 * @author awoods 026 */ 027@XmlAccessorType(XmlAccessType.FIELD) 028public class Param extends Describable { 029 030 @XmlElement(namespace = "http://java.sun.com/xml/ns/javaee", 031 name = "param-name") 032 String name; 033 034 @XmlElement(namespace = "http://java.sun.com/xml/ns/javaee", 035 name = "param-value") 036 String value; 037 038 public Param() { 039 } 040 041 public Param(final String name, final String value) { 042 this.name = name; 043 this.value = value; 044 } 045 046 public String name() { 047 return name; 048 } 049 050 public String value() { 051 return value; 052 } 053 054 @Override 055 public boolean equals(final Object object) { 056 if (this.getClass().equals(object.getClass())) { 057 final Param that = (Param) object; 058 final boolean name = 059 (this.name == null) ? that.name == null : this.name 060 .equals(that.name); 061 final boolean value = 062 (this.value == null) ? that.value == null : this.value 063 .equals(that.value); 064 return name && value; 065 } 066 return false; 067 } 068 069 @Override 070 public int hashCode() { 071 return name.hashCode() + 2 * value.hashCode(); 072 073 } 074}