KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > tools > jbicommon > descriptor > Identification


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: Identification.java 12:14:20 rmarins $
20  * -------------------------------------------------------------------------
21  */

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import org.apache.commons.lang.builder.EqualsBuilder;
26 import org.apache.commons.lang.builder.HashCodeBuilder;
27 import org.apache.commons.lang.builder.ToStringBuilder;
28
29 /**
30  * The identification production is used to provide identifying information for
31  * components, shared libraries, service units, and service assemblies.
32  *
33  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
34  * @since Petals 1.0
35  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
36  */

37 public class Identification extends ExtensibleJbiElement {
38
39     /**
40      * Item name.
41      */

42     private String JavaDoc name;
43
44     /**
45      * Item description.
46      */

47     private String JavaDoc description;
48
49     /**
50      * Default constructor.
51      */

52     public Identification() { // NOPMD by gblondelle
53
super();
54     }
55
56     @Override JavaDoc
57     public boolean equals(final Object JavaDoc other) {
58         if (!(other instanceof Identification)) {
59             return false; // NOPMD by gblondelle
60
}
61         Identification castOther = (Identification) other;
62         return new EqualsBuilder().append(name, castOther.name).append(
63                 description, castOther.description).isEquals();
64     }
65
66     /**
67      * A longer (one sentence) description of the item.
68      *
69      * @return <code>String</code> the item description.
70      */

71     public String JavaDoc getDescription() {
72         return description;
73     }
74
75     /**
76      * The name of the item. This is a human-friendly identifier for the item.
77      *
78      * @return <code>String</code> the item name.
79      */

80     public String JavaDoc getName() {
81         return name;
82     }
83
84     //
85
// Getters and Setters
86
//
87

88     @Override JavaDoc
89     public int hashCode() {
90         return new HashCodeBuilder().append(name).append(description)
91                 .toHashCode();
92     }
93
94     @Override JavaDoc
95     public String JavaDoc toString() {
96         return new ToStringBuilder(this).append("name", name).append(
97                 "description", description).toString();
98     }
99
100     /**
101      * A longer (one sentence) description of the item.
102      *
103      * @param description
104      * <code>String</code> item description to set.
105      */

106     protected void setDescription(final String JavaDoc description) {
107         this.description = description;
108     }
109
110     /**
111      * The name of the item. This is a human-friendly identifier for the item.
112      *
113      * @param name
114      * <code>String</code> item name to set.
115      */

116     protected void setName(final String JavaDoc name) {
117         this.name = name;
118     }
119
120 }
121
Popular Tags