Source for org.jfree.xml.generator.model.PropertyInfo

   1: /* ========================================================================
   2:  * JCommon : a free general purpose class library for the Java(tm) platform
   3:  * ========================================================================
   4:  *
   5:  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
   6:  * 
   7:  * Project Info:  http://www.jfree.org/jcommon/index.html
   8:  *
   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.
  13:  *
  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.
  18:  *
  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, 
  22:  * USA.  
  23:  *
  24:  * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
  25:  * in the United States and other countries.]
  26:  * 
  27:  * -----------------
  28:  * PropertyInfo.java
  29:  * -----------------
  30:  * (C)opyright 2003, 2004, by Thomas Morgner and Contributors.
  31:  *
  32:  * Original Author:  Thomas Morgner;
  33:  * Contributor(s):   David Gilbert (for Object Refinery Limited);
  34:  *
  35:  * $Id: PropertyInfo.java,v 1.2 2005/10/18 13:32:37 mungady Exp $
  36:  *
  37:  * Changes 
  38:  * -------
  39:  * 21-Jun-2003 : Initial version (TM)
  40:  *  
  41:  */
  42: 
  43: package org.jfree.xml.generator.model;
  44: 
  45: /**
  46:  * Information about a property.
  47:  */
  48: public class PropertyInfo extends TypeInfo {
  49: 
  50:     /** Preserve? */
  51:     private boolean preserve;
  52:     
  53:     /** Is there a read method available? */
  54:     private boolean readMethodAvailable;
  55:     
  56:     /** Is there a write method available? */
  57:     private boolean writeMethodAvailable;
  58: 
  59:     /** The property type - indicates how the property is described in XML. */
  60:     private PropertyType propertyType;
  61:     
  62:     /** The XML name. */
  63:     private String xmlName;
  64:     
  65:     /** The XML handler. */
  66:     private String xmlHandler;
  67: 
  68:     /**
  69:      * Creates a new info object for a property.
  70:      * 
  71:      * @param name  the property name.
  72:      * @param type  the class.
  73:      */
  74:     public PropertyInfo(final String name, final Class type) {
  75:         super(name, type);
  76:         this.propertyType = PropertyType.ELEMENT;
  77:     }
  78: 
  79:     /**
  80:      * Returns the preserve flag.
  81:      * 
  82:      * @return the preserve flag.
  83:      */
  84:     public boolean isPreserve() {
  85:         return this.preserve;
  86:     }
  87: 
  88:     /**
  89:      * Sets the preserve flag.
  90:      * 
  91:      * @param preserve  the preserve flag.
  92:      */
  93:     public void setPreserve(final boolean preserve) {
  94:         this.preserve = preserve;
  95:     }
  96: 
  97:     /**
  98:      * Returns the property type.  This describes how the property is handled in XML.
  99:      * 
 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: }