View Javadoc

1   /*
2    * Copyright (C) 2004 TiongHiang Lee
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this library; if not,  write to the Free Software
16   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   * Email: thlee@onemindsoft.org
19   */
20  
21  package org.onemind.commons.relabean;
22  
23  import java.beans.IntrospectionException;
24  import java.io.IOException;
25  import java.io.Writer;
26  import java.lang.reflect.Method;
27  /***
28   * A default extension to Sun's bean property descriptor
29   * @author TiongHiang Lee (thlee@onemindsoft.org)
30   * @version $Id: PropertyDescriptor.java,v 1.2 2004/08/26 16:28:58 thlee Exp $ $Name:  $
31   */
32  public final class PropertyDescriptor extends java.beans.PropertyDescriptor
33  {
34  
35      /***
36       * {@inheritDoc}
37       */
38      public PropertyDescriptor(String propertyName, Class beanClass)
39              throws IntrospectionException
40      {
41          super(propertyName, beanClass);
42      }
43  
44      /***
45       * {@inheritDoc}
46       */
47      public PropertyDescriptor(String propertyName, Method getter, Method setter)
48              throws IntrospectionException
49      {
50          super(propertyName, getter, setter);
51      }
52  
53      /***
54       * {@inheritDoc}
55       */
56      public PropertyDescriptor(String propertyName, Class beanClass,
57              String getterName, String setterName) throws IntrospectionException
58      {
59          super(propertyName, beanClass, getterName, setterName);
60      }
61  
62      /***
63       * Dump the property
64       * @param prefix the prefix
65       * @param writer the writer
66       * @throws IOException if there's IO problem
67       */
68      public final void dump(String prefix, Writer writer) throws IOException
69      {
70          writer.write(prefix + "Property name: " + getName() + "\n");
71          writer.write(prefix + "\ttype: " + getPropertyType() + "\n");
72          writer.write(prefix + "\treadMethod: " + getReadMethod() + "\n");
73          writer.write(prefix + "\twriteMethod: " + getWriteMethod() + "\n");
74      }
75  }