001 /* ========================================================================
002 * JCommon : a free general purpose class library for the Java(tm) platform
003 * ========================================================================
004 *
005 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006 *
007 * Project Info: http://www.jfree.org/jcommon/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022 * USA.
023 *
024 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025 * in the United States and other countries.]
026 *
027 * -----------------
028 * PropertyInfo.java
029 * -----------------
030 * (C)opyright 2003, 2004, by Thomas Morgner and Contributors.
031 *
032 * Original Author: Thomas Morgner;
033 * Contributor(s): David Gilbert (for Object Refinery Limited);
034 *
035 * $Id: PropertyInfo.java,v 1.2 2005/10/18 13:32:37 mungady Exp $
036 *
037 * Changes
038 * -------
039 * 21-Jun-2003 : Initial version (TM)
040 *
041 */
042
043 package org.jfree.xml.generator.model;
044
045 /**
046 * Information about a property.
047 */
048 public class PropertyInfo extends TypeInfo {
049
050 /** Preserve? */
051 private boolean preserve;
052
053 /** Is there a read method available? */
054 private boolean readMethodAvailable;
055
056 /** Is there a write method available? */
057 private boolean writeMethodAvailable;
058
059 /** The property type - indicates how the property is described in XML. */
060 private PropertyType propertyType;
061
062 /** The XML name. */
063 private String xmlName;
064
065 /** The XML handler. */
066 private String xmlHandler;
067
068 /**
069 * Creates a new info object for a property.
070 *
071 * @param name the property name.
072 * @param type the class.
073 */
074 public PropertyInfo(final String name, final Class type) {
075 super(name, type);
076 this.propertyType = PropertyType.ELEMENT;
077 }
078
079 /**
080 * Returns the preserve flag.
081 *
082 * @return the preserve flag.
083 */
084 public boolean isPreserve() {
085 return this.preserve;
086 }
087
088 /**
089 * Sets the preserve flag.
090 *
091 * @param preserve the preserve flag.
092 */
093 public void setPreserve(final boolean preserve) {
094 this.preserve = preserve;
095 }
096
097 /**
098 * Returns the property type. This describes how the property is handled in XML.
099 *
100 * @return the property type.
101 */
102 public PropertyType getPropertyType() {
103 return this.propertyType;
104 }
105
106 /**
107 * Sets the property type.
108 *
109 * @param propertyType the type (<code>null</code> not permitted).
110 */
111 public void setPropertyType(final PropertyType propertyType) {
112 if (propertyType == null) {
113 throw new NullPointerException();
114 }
115 this.propertyType = propertyType;
116 }
117
118 /**
119 * Returns the XML handler.
120 *
121 * @return the XML handler.
122 */
123 public String getXmlHandler() {
124 return this.xmlHandler;
125 }
126
127 /**
128 * Sets the XML handler.
129 *
130 * @param xmlHandler the fully qualified class name for the attribute handler.
131 */
132 public void setXmlHandler(final String xmlHandler) {
133 this.xmlHandler = xmlHandler;
134 }
135
136 /**
137 * Returns the XML name.
138 *
139 * @return the XML name.
140 */
141 public String getXmlName() {
142 return this.xmlName;
143 }
144
145 /**
146 * Sets the XML name.
147 *
148 * @param xmlName the XML name.
149 */
150 public void setXmlName(final String xmlName) {
151 this.xmlName = xmlName;
152 }
153
154 /**
155 * Returns <code>true</code> if there is a read method available, and <code>false</code>
156 * otherwise.
157 *
158 * @return a boolean.
159 */
160 public boolean isReadMethodAvailable() {
161 return this.readMethodAvailable;
162 }
163
164 /**
165 * Sets a flag indicating whether or not there is a read method for this property.
166 *
167 * @param readMethodAvailable the new value of the flag.
168 */
169 public void setReadMethodAvailable(final boolean readMethodAvailable) {
170 this.readMethodAvailable = readMethodAvailable;
171 }
172
173 /**
174 * Returns <code>true</code> if there is a write method available, and <code>false</code>
175 * otherwise.
176 *
177 * @return a boolean.
178 */
179 public boolean isWriteMethodAvailable() {
180 return this.writeMethodAvailable;
181 }
182
183 /**
184 * Sets a flag indicating whether or not there is a write method for this property.
185 *
186 * @param writeMethodAvailable the new value of the flag.
187 */
188 public void setWriteMethodAvailable(final boolean writeMethodAvailable) {
189 this.writeMethodAvailable = writeMethodAvailable;
190 }
191
192 }