AuthorVo.java
01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02  *
03  * Copyright 2000-2011,  Michael Meyling <mime@qedeq.org>.
04  *
05  * "Hilbert II" is free software; you can redistribute
06  * it and/or modify it under the terms of the GNU General Public
07  * License as published by the Free Software Foundation; either
08  * version 2 of the License, or (at your option) any later version.
09  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  */
15 
16 package org.qedeq.kernel.se.dto.module;
17 
18 import org.qedeq.base.utility.EqualsUtility;
19 import org.qedeq.kernel.se.base.module.Author;
20 import org.qedeq.kernel.se.base.module.Latex;
21 
22 
23 /**
24  * Describes a QEDEQ module author.
25  *
26  @author  Michael Meyling
27  */
28 public class AuthorVo implements Author {
29 
30     /** Author name. */
31     private Latex name;
32 
33     /** Email address of author. */
34     private String email;
35 
36     /**
37      * Constructs an author.
38      *
39      @param   name    Author name.
40      @param   email   Author's email address.
41      */
42     public AuthorVo(final LatexVo name, final String email) {
43         this.name = name;
44         this.email = email;
45     }
46 
47     /**
48      * Constructs an empty author.
49      */
50     public AuthorVo() {
51         // nothing to do
52     }
53 
54     /**
55      * Set name of author.
56      *
57      @param   name    Author name.
58      */
59     public final void setName(final LatexVo name) {
60         this.name = name;
61     }
62 
63     public final Latex getName() {
64         return name;
65     }
66 
67     /**
68      * Set author's email address.
69      *
70      @param   email   Email address.
71      */
72     public final void setEmail(final String email) {
73         this.email = email;
74     }
75 
76     public final String getEmail() {
77         return email;
78     }
79 
80     public boolean equals(final Object obj) {
81         if (!(obj instanceof AuthorVo)) {
82             return false;
83         }
84         final AuthorVo other = (AuthorVoobj;
85         return  EqualsUtility.equals(getName(), other.getName())
86             &&  EqualsUtility.equals(getEmail(), other.getEmail());
87     }
88 
89     public int hashCode() {
90         return (getName() != null ? getName().hashCode() 0)
91             (getEmail() != null ^ getEmail().hashCode() 0);
92     }
93 
94     public String toString() {
95         return getName() (getEmail() != null "<" + getEmail() ">" "");
96     }
97 
98 }