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
* MultiplexMappingInfo.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: MultiplexMappingInfo.java,v 1.2 2005/10/18 13:32:37 mungady Exp $
39
* 16-Nov-2003 : Initial version
43
package org.jfree.xml.generator.model;
45
import java.util.Arrays;
48
* Defines the multiplex entries for a certain base class. Multiplexers are
49
* used to select a specific handler if more than one class will match the
52
* Multiplexers override automatic mappings and can be redefined using manual
55
public class MultiplexMappingInfo {
57
/** The base class. */
58
private Class baseClass;
60
/** The type attribute. */
61
private String typeAttribute;
63
/** The child classes. */
64
private TypeInfo[] childClasses;
67
private Comments comments;
70
private String source;
73
* Creates a new instance for the specified class.
75
* @param baseClass the base class.
77
public MultiplexMappingInfo(final Class baseClass) {
78
this(baseClass, "type");
82
* Creates a new instance for the specified class.
84
* @param baseClass the base class (<code>null</code> not permitted).
85
* @param typeAttribute the type attribute (<code>null</code> not permitted).
87
public MultiplexMappingInfo(final Class baseClass, final String typeAttribute) {
88
if (baseClass == null) {
89
throw new NullPointerException("BaseClass");
91
if (typeAttribute == null) {
92
throw new NullPointerException("TypeAttribute");
94
this.baseClass = baseClass;
95
this.typeAttribute = typeAttribute;
99
* Returns the base class.
101
* @return The base class.
103
public Class getBaseClass() {
104
return this.baseClass;
108
* Returns the type attribute.
110
* @return The type attribute.
112
public String getTypeAttribute() {
113
return this.typeAttribute;
117
* Returns the child classes.
119
* @return The child classes.
121
public TypeInfo[] getChildClasses() {
122
return this.childClasses;
126
* Sets the child classes.
128
* @param childClasses the child classes.
130
public void setChildClasses(final TypeInfo[] childClasses) {
131
this.childClasses = childClasses;
135
* Returns the comments.
137
* @return The comments.
139
public Comments getComments() {
140
return this.comments;
146
* @param comments the comments.
148
public void setComments(final Comments comments) {
149
this.comments = comments;
153
* Returns the source.
155
* @return The source.
157
public String getSource() {
164
* @param source the source.
166
public void setSource(final String source) {
167
this.source = source;
171
* Tests this object for equality with another object.
173
* @param o the other object.
177
public boolean equals(final Object o) {
181
if (!(o instanceof MultiplexMappingInfo)) {
185
final MultiplexMappingInfo multiplexMappingInfo = (MultiplexMappingInfo) o;
187
if (!this.baseClass.equals(multiplexMappingInfo.baseClass)) {
190
if (!Arrays.equals(this.childClasses, multiplexMappingInfo.childClasses)) {
193
if (!this.typeAttribute.equals(multiplexMappingInfo.typeAttribute)) {
201
* Returns a hash code for this object.
203
* @return A hash code.
205
public int hashCode() {
207
result = this.baseClass.hashCode();
208
result = 29 * result + this.typeAttribute.hashCode();