View Javadoc
1   package org.synchronoss.cpo.core.meta.bean;
2   
3   /*-
4    * [[
5    * core
6    * ==
7    * Copyright (C) 2003 - 2026 Exaxis LLC, Synchronoss Technologies Inc
8    * ==
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ]]
23   */
24  
25  /**
26   * Plain-data holder for a name and description, the common base for the CPO metadata bean classes
27   * ({@code CpoClass}, {@code CpoArgument}, {@code CpoFunctionGroup}) that all identify themselves
28   * primarily by name.
29   *
30   * @author dberry
31   */
32  public class CpoClassBean implements java.io.Serializable {
33  
34    private static final long serialVersionUID = 1L;
35  
36    /*
37     * Properties
38     */
39    /** The name of this metadata element. */
40    private String name;
41  
42    /** The description of this metadata element. */
43    private String description;
44  
45    /** Creates an empty instance. */
46    public CpoClassBean() {}
47  
48    /*
49     * Getters and Setters
50     */
51  
52    /**
53     * Gets the name of this metadata element.
54     *
55     * @return the name
56     */
57    public String getName() {
58      return this.name;
59    }
60  
61    /**
62     * Sets the name of this metadata element.
63     *
64     * @param name the name
65     */
66    public void setName(String name) {
67      this.name = name;
68    }
69  
70    /**
71     * Gets the human-readable description of this metadata element, as loaded from the meta XML.
72     *
73     * @return the description, or {@code null} if none was specified
74     */
75    public String getDescription() {
76      return description;
77    }
78  
79    /**
80     * Sets the human-readable description of this metadata element.
81     *
82     * @param description the description
83     */
84    public void setDescription(String description) {
85      this.description = description;
86    }
87  
88    @Override
89    public int hashCode() {
90      int result = 0;
91      result = 31 * result + getClass().getName().hashCode();
92      result = 31 * result + (getName() != null ? getName().hashCode() : 0);
93      result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
94      return result;
95    }
96  
97    @Override
98    public String toString() {
99      StringBuilder str = new StringBuilder();
100     str.append("name = " + getName() + "\n");
101     str.append("description = " + getDescription() + "\n");
102     return str.toString();
103   }
104 
105   @Override
106   public boolean equals(Object o) {
107     if (this == o) return true;
108 
109     if (o == null || getClass() != o.getClass()) return false;
110 
111     CpoClassBean that = (CpoClassBean) o;
112 
113     if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null)
114       return false;
115 
116     return getDescription() != null
117         ? getDescription().equals(that.getDescription())
118         : that.getDescription() == null;
119   }
120 }