1
/* ========================================================================
2
* JCommon : a free general purpose class library for the Java(tm) platform
3
* ========================================================================
5
* (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
7
* Project Info: http://www.jfree.org/jcommon/index.html
9
* This library is free software; you can redistribute it and/or modify it
10
* under the terms of the GNU Lesser General Public License as published by
11
* the Free Software Foundation; either version 2.1 of the License, or
12
* (at your option) any later version.
14
* This library is distributed in the hope that it will be useful, but
15
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17
* License for more details.
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25
* in the United States and other countries.]
27
* ---------------------
28
* ClassDescription.java
29
* ---------------------
30
* (C)opyright 2003, 2004, by Thomas Morgner and Contributors.
32
* Original Author: Thomas Morgner;
33
* Contributor(s): David Gilbert (for Object Refinery Limited);
35
* $Id: ClassDescription.java,v 1.2 2005/10/18 13:32:37 mungady Exp $
39
* 21-Jun-2003 : Initial version (TM);
40
* 26-Nov-2003 : Updated header and Javadocs (DG);
44
package org.jfree.xml.generator.model;
47
* A description of a Java class.
49
public class ClassDescription {
51
/** Storage for info about properties. */
52
private PropertyInfo[] properties;
54
/** Constructor descriptions. */
55
private TypeInfo[] constructorDescription;
58
private Class objectClass;
61
private String description;
63
/** The register key. */
64
private String registerKey;
66
/** The super class. */
67
private Class superClass;
70
private boolean preserve;
73
private Comments comments;
76
private String source;
79
* Creates a new class description.
81
* @param objectClass the class.
83
public ClassDescription(final Class objectClass) {
84
if (objectClass == null) {
85
throw new NullPointerException();
87
this.objectClass = objectClass;
91
* Returns the info about properties.
93
* @return the info about properties.
95
public PropertyInfo[] getProperties() {
96
return this.properties;
100
* Sets the info about the class properties.
102
* @param properties the properties.
104
public void setProperties(final PropertyInfo[] properties) {
105
this.properties = properties;
109
* Returns the object's class.
111
* @return the object's class.
113
public Class getObjectClass() {
114
return this.objectClass;
118
* Returns the description.
120
* @return the description.
122
public String getDescription() {
123
return this.description;
127
* Sets the description for the object.
129
* @param description the description.
131
public void setDescription(final String description) {
132
this.description = description;
136
* Returns the class name.
138
* @return the class name.
140
public String getName() {
141
if (getObjectClass() == null) {
144
return getObjectClass().getName();
148
* Returns the super class.
150
* @return the super class.
152
public Class getSuperClass() {
153
return this.superClass;
157
* Sets the super class.
159
* @param superClass the super class.
161
public void setSuperClass(final Class superClass) {
162
this.superClass = superClass;
166
* Returns the preserve flag.
170
public boolean isPreserve() {
171
return this.preserve;
175
* Sets the preserve flag.
177
* @param preserve the new value of the flag.
179
public void setPreserve(final boolean preserve) {
180
this.preserve = preserve;
184
* Returns the register key.
186
* @return the register key.
188
public String getRegisterKey() {
189
return this.registerKey;
193
* Sets the register key.
195
* @param registerKey the register key.
197
public void setRegisterKey(final String registerKey) {
198
this.registerKey = registerKey;
202
* Returns the constructor descriptions.
204
* @return the constructor descriptions.
206
public TypeInfo[] getConstructorDescription() {
207
return this.constructorDescription;
211
* Sets the constructor description.
213
* @param constructorDescription the constructor description.
215
public void setConstructorDescription(final TypeInfo[] constructorDescription) {
216
this.constructorDescription = constructorDescription;
220
* Returns a property.
222
* @param name the property name.
224
* @return a property.
226
public PropertyInfo getProperty (final String name) {
227
if (this.properties == null) {
230
for (int i = 0; i < this.properties.length; i++) {
231
if (this.properties[i].getName().equals(name)) {
232
return this.properties[i];
239
* Returns <code>true</code> if the description is undefined.
243
public boolean isUndefined() {
244
if (this.properties != null) {
245
if (this.properties.length > 0) {
252
if (getRegisterKey() != null) {
255
if (getConstructorDescription() != null) {
256
if (getConstructorDescription().length > 0) {
264
* Returns the comments for the class description.
266
* @return The comments.
268
public Comments getComments() {
269
return this.comments;
273
* Sets the comments for the class description.
275
* @param comments the comments.
277
public void setComments(final Comments comments) {
278
this.comments = comments;
282
* Returns the source for the class description.
284
* @return The source.
286
public String getSource() {
291
* Sets the source for the class description.
293
* @param source the source.
295
public void setSource(final String source) {
296
this.source = source;