01: // JdbcBeanInterfaceBeanInfo.java
02: // $Id: JdbcBeanInterfaceBeanInfo.java,v 1.4 2000/08/16 21:37:49 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 2000.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05: package org.w3c.tools.jdbc;
06:
07: import java.beans.BeanInfo;
08: import java.beans.SimpleBeanInfo;
09: import java.beans.IntrospectionException;
10: import java.beans.Introspector;
11: import java.beans.PropertyDescriptor;
12:
13: /**
14: * @version $Revision: 1.4 $
15: * @author Benoît Mahé (bmahe@w3.org)
16: */
17: public class JdbcBeanInterfaceBeanInfo extends SimpleBeanInfo {
18:
19: private PropertyDescriptor getPropertyDescriptor(String name,
20: boolean hidden) throws IntrospectionException {
21: PropertyDescriptor pd = new PropertyDescriptor(name,
22: JdbcBeanInterface.class);
23: pd.setHidden(hidden);
24: return pd;
25: }
26:
27: private PropertyDescriptor getPropertyDescriptor(String name,
28: String getter, String setter, boolean hidden)
29: throws IntrospectionException {
30: PropertyDescriptor pd = new PropertyDescriptor(name,
31: JdbcBeanInterface.class, getter, setter);
32: pd.setHidden(hidden);
33: return pd;
34: }
35:
36: public PropertyDescriptor[] getPropertyDescriptors() {
37: try {
38: PropertyDescriptor[] pds = {
39: getPropertyDescriptor("jdbcDriver", true),
40: getPropertyDescriptor("jdbcUser", true),
41: getPropertyDescriptor("jdbcPassword", true),
42: getPropertyDescriptor("jdbcURI", true),
43: getPropertyDescriptor("jdbcTable", true),
44: getPropertyDescriptor("maxConn", true),
45: getPropertyDescriptor("readOnly", true),
46: getPropertyDescriptor("serializer",
47: "getSerializer", null, true) };
48: return pds;
49: } catch (IntrospectionException ex) {
50: ex.printStackTrace();
51: return null;
52: }
53:
54: }
55:
56: }
|