001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.http.commons.webxml.bind;
007
008import javax.xml.bind.annotation.XmlAccessType;
009import javax.xml.bind.annotation.XmlAccessorType;
010import javax.xml.bind.annotation.XmlElement;
011
012/**
013 * <p>Param class.</p>
014 *
015 * @author awoods
016 */
017@XmlAccessorType(XmlAccessType.FIELD)
018public class Param extends Describable {
019
020    @XmlElement(namespace = "http://java.sun.com/xml/ns/javaee",
021            name = "param-name")
022    String name;
023
024    @XmlElement(namespace = "http://java.sun.com/xml/ns/javaee",
025            name = "param-value")
026    String value;
027
028    public Param() {
029    }
030
031    public Param(final String name, final String value) {
032        this.name = name;
033        this.value = value;
034    }
035
036    public String name() {
037        return name;
038    }
039
040    public String value() {
041        return value;
042    }
043
044    @Override
045    public boolean equals(final Object object) {
046        if (this.getClass().equals(object.getClass())) {
047            final Param that = (Param) object;
048            final boolean name =
049                (this.name == null) ? that.name == null : this.name
050                        .equals(that.name);
051            final boolean value =
052                (this.value == null) ? that.value == null : this.value
053                        .equals(that.value);
054            return name && value;
055        }
056        return false;
057    }
058
059    @Override
060    public int hashCode() {
061        return name.hashCode() + 2 * value.hashCode();
062
063    }
064}