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.XmlElement; 009import javax.xml.bind.annotation.XmlRootElement; 010 011/** 012 * <p>Listener class.</p> 013 * 014 * @author awoods 015 */ 016@XmlRootElement(namespace = "http://java.sun.com/xml/ns/javaee", 017 name = "listener") 018public class Listener extends Displayable { 019 020 public Listener() { 021 } 022 023 public Listener(final String displayName, final String className) { 024 this.displayName = displayName; 025 this.className = className; 026 } 027 028 @XmlElement(namespace = "http://java.sun.com/xml/ns/javaee", 029 name = "listener-class") 030 String className; 031 032 public String className() { 033 return this.className; 034 } 035 036 @Override 037 public boolean equals(final Object object) { 038 if (object instanceof Listener) { 039 final Listener that = (Listener) object; 040 final boolean className = 041 (this.className == null) ? that.className == null 042 : this.className.equals(that.className); 043 final boolean displayName = 044 (this.displayName == null) ? that.displayName == null 045 : this.displayName.equals(that.displayName); 046 return className && displayName; 047 } 048 return false; 049 } 050 051 @Override 052 public int hashCode() { 053 return className.hashCode() + 2 * displayName.hashCode(); 054 } 055 056}