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