You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by cr...@apache.org on 2001/12/28 01:33:56 UTC
cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MutableDynaClass.java DynaBean.java DynaClass.java
craigmcc 01/12/27 16:33:56
Modified: beanutils/src/java/org/apache/commons/beanutils
DynaBean.java DynaClass.java
Added: beanutils/src/java/org/apache/commons/beanutils
MutableDynaClass.java
Log:
Simplify the DynaClass method signatures to those required for immutable
DynaClass implementations. For now, save the methods for a mutable
implementation in a new interface (MutableDynaClass), but no guarantees
that it will remain useful - mutability can be an implementation feature and
may not need to be exposed formally in an interface at all.
Revision Changes Path
1.3 +5 -4 jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaBean.java
Index: DynaBean.java
===================================================================
RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DynaBean.java 2001/12/27 08:11:05 1.2
+++ DynaBean.java 2001/12/28 00:33:56 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaBean.java,v 1.2 2001/12/27 08:11:05 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/27 08:11:05 $
+ * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaBean.java,v 1.3 2001/12/28 00:33:56 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/28 00:33:56 $
*
* ====================================================================
*
@@ -71,7 +71,8 @@
* purpose of retrieving and setting property values.</p>
*
* @author Craig McClanahan
- * @version $Revision: 1.2 $ $Date: 2001/12/27 08:11:05 $
+ * @author Paulo Gaspar
+ * @version $Revision: 1.3 $ $Date: 2001/12/28 00:33:56 $
*/
public interface DynaBean {
1.3 +6 -106 jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaClass.java
Index: DynaClass.java
===================================================================
RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaClass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DynaClass.java 2001/12/27 21:17:38 1.2
+++ DynaClass.java 2001/12/28 00:33:56 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaClass.java,v 1.2 2001/12/27 21:17:38 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/27 21:17:38 $
+ * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaClass.java,v 1.3 2001/12/28 00:33:56 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/28 00:33:56 $
*
* ====================================================================
*
@@ -75,69 +75,14 @@
*
* @author Craig McClanahan
* @author Michael Smith
- * @version $Revision: 1.2 $ $Date: 2001/12/27 21:17:38 $
+ * @author Paulo Gaspar
+ * @version $Revision: 1.3 $ $Date: 2001/12/28 00:33:56 $
*/
public interface DynaClass {
/**
- * Add a new dynamic property with no restrictions on data type,
- * readability, or writeability.
- *
- * @param name Name of the new dynamic property
- *
- * @exception IllegalArgumentException if name is null
- * @exception IllegalStateException if this DynaClass is currently
- * restricted, so no new properties can be added
- */
- public void add(String name);
-
-
- /**
- * Add a new dynamic property with the specified data type, but with
- * no restrictions on readability or writeability.
- *
- * @param name Name of the new dynamic property
- * @param type Data type of the new dynamic property (null for no
- * restrictions)
- *
- * @exception IllegalArgumentException if name is null
- * @exception IllegalStateException if this DynaClass is currently
- * restricted, so no new properties can be added
- */
- public void add(String name, Class type);
-
-
- /**
- * Add a new dynamic property with the specified data type, readability,
- * and writeability.
- *
- * @param name Name of the new dynamic property
- * @param type Data type of the new dynamic property (null for no
- * restrictions)
- * @param readable Set to <code>true</code> if this property value
- * should be readable
- * @param writeable Set to <code>true</code> if this property value
- * should be writeable
- *
- * @exception IllegalArgumentException if name is null
- * @exception IllegalStateException if this DynaClass is currently
- * restricted, so no new properties can be added
- */
- public void add(String name, Class type, boolean readable,
- boolean writeable);
-
-
- /**
- * Return the Class object we will use to create new instances in the
- * <code>newInstance()</code> method. This Class <strong>MUST</strong>
- * implement the <code>DynaBean</code> interface.
- */
- public Class getDynaBeanClass();
-
-
- /**
* Return the name of this DynaClass (analogous to the
* <code>getName()</code> method of <code>java.lang.Class</code), which
* allows the same <code>DynaClass</code> implementation class to support
@@ -153,7 +98,7 @@
* @param name Name of the dynamic property for which a descriptor
* is requested
*/
- public PropertyDescriptor[] getPropertyDescriptor(String name);
+ public PropertyDescriptor getPropertyDescriptor(String name);
/**
@@ -169,55 +114,10 @@
/**
- * Is this DynaClass currently restricted? If so, no changes to the
- * existing registration of property names, data types, readability, or
- * writeability are allowed.
- */
- public boolean isRestricted();
-
-
- /**
* Instantiate and return a new DynaBean instance, using the implementation
* class specified by the <code>dynaBeanClass</code> property.
*/
public DynaBean newInstance();
-
-
- /**
- * Remove the specified dynamic property, and any associated data type,
- * readability, and writeability, from this dynamic class.
- * <strong>NOTE</strong> - This does <strong>NOT</strong> cause any
- * corresponding property values to be removed from DynaBean instances
- * associated with this DynaClass.
- *
- * @param name Name of the dynamic property to remove
- *
- * @exception IllegalArgumentException if name is null
- * @exception IllegalStateException if this DynaClass is currently
- * restricted, so no properties can be removed
- */
- public void remove(String name);
-
-
- /**
- * Set the Class object we will use to create new instances in the
- * <code>newInstance()</code> method. This Class <strong>MUST</strong>
- * implement the <code>DynaBean</code> interface.
- *
- * @param clazz The new Class object
- *
- * @exception IllegalArgumentException if the specified Class does not
- * implement the <code>DynaBean</code> interface
- */
- public void setDynaBeanClass(Class clazz);
-
-
- /**
- * Set the restricted state of this DynaClass to the specified value.
- *
- * @param restricted The new restricted state
- */
- public void setRestricted(boolean restricted);
}
1.1 jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MutableDynaClass.java
Index: MutableDynaClass.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MutableDynaClass.java,v 1.1 2001/12/28 00:33:56 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/12/28 00:33:56 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.beanutils;
import java.beans.PropertyDescriptor;
/**
* <p>A specialized extension to <code>DynaClass</code> that allows properties
* to be added or removed dynamically.</p>
*
* <p><strong>WARNING</strong> - No guarantees that this will be in the final
* APIs ... it's here primarily to preserve some concepts that were in the
* original proposal for further discussion.</p>
*
* @author Craig McClanahan
* @author Michael Smith
* @author Paulo Gaspar
* @version $Revision: 1.1 $ $Date: 2001/12/28 00:33:56 $
*/
public interface MutableDynaClass extends DynaClass {
/**
* Add a new dynamic property with no restrictions on data type,
* readability, or writeability.
*
* @param name Name of the new dynamic property
*
* @exception IllegalArgumentException if name is null
* @exception IllegalStateException if this DynaClass is currently
* restricted, so no new properties can be added
*/
public void add(String name);
/**
* Add a new dynamic property with the specified data type, but with
* no restrictions on readability or writeability.
*
* @param name Name of the new dynamic property
* @param type Data type of the new dynamic property (null for no
* restrictions)
*
* @exception IllegalArgumentException if name is null
* @exception IllegalStateException if this DynaClass is currently
* restricted, so no new properties can be added
*/
public void add(String name, Class type);
/**
* Add a new dynamic property with the specified data type, readability,
* and writeability.
*
* @param name Name of the new dynamic property
* @param type Data type of the new dynamic property (null for no
* restrictions)
* @param readable Set to <code>true</code> if this property value
* should be readable
* @param writeable Set to <code>true</code> if this property value
* should be writeable
*
* @exception IllegalArgumentException if name is null
* @exception IllegalStateException if this DynaClass is currently
* restricted, so no new properties can be added
*/
public void add(String name, Class type, boolean readable,
boolean writeable);
/**
* Is this DynaClass currently restricted? If so, no changes to the
* existing registration of property names, data types, readability, or
* writeability are allowed.
*/
public boolean isRestricted();
/**
* Remove the specified dynamic property, and any associated data type,
* readability, and writeability, from this dynamic class.
* <strong>NOTE</strong> - This does <strong>NOT</strong> cause any
* corresponding property values to be removed from DynaBean instances
* associated with this DynaClass.
*
* @param name Name of the dynamic property to remove
*
* @exception IllegalArgumentException if name is null
* @exception IllegalStateException if this DynaClass is currently
* restricted, so no properties can be removed
*/
public void remove(String name);
/**
* Set the restricted state of this DynaClass to the specified value.
*
* @param restricted The new restricted state
*/
public void setRestricted(boolean restricted);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>