001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.commons.beanutils;
019:
020: /**
021: * <p>A specialized extension to <code>DynaClass</code> that allows properties
022: * to be added or removed dynamically.</p>
023: *
024: * <p><strong>WARNING</strong> - No guarantees that this will be in the final
025: * APIs ... it's here primarily to preserve some concepts that were in the
026: * original proposal for further discussion.</p>
027: *
028: * @author Craig McClanahan
029: * @author Michael Smith
030: * @author Paulo Gaspar
031: * @version $Revision: 555824 $ $Date: 2007-07-13 01:27:15 +0100 (Fri, 13 Jul 2007) $
032: */
033:
034: public interface MutableDynaClass extends DynaClass {
035:
036: /**
037: * Add a new dynamic property with no restrictions on data type,
038: * readability, or writeability.
039: *
040: * @param name Name of the new dynamic property
041: *
042: * @exception IllegalArgumentException if name is null
043: * @exception IllegalStateException if this DynaClass is currently
044: * restricted, so no new properties can be added
045: */
046: public void add(String name);
047:
048: /**
049: * Add a new dynamic property with the specified data type, but with
050: * no restrictions on readability or writeability.
051: *
052: * @param name Name of the new dynamic property
053: * @param type Data type of the new dynamic property (null for no
054: * restrictions)
055: *
056: * @exception IllegalArgumentException if name is null
057: * @exception IllegalStateException if this DynaClass is currently
058: * restricted, so no new properties can be added
059: */
060: public void add(String name, Class type);
061:
062: /**
063: * Add a new dynamic property with the specified data type, readability,
064: * and writeability.
065: *
066: * @param name Name of the new dynamic property
067: * @param type Data type of the new dynamic property (null for no
068: * restrictions)
069: * @param readable Set to <code>true</code> if this property value
070: * should be readable
071: * @param writeable Set to <code>true</code> if this property value
072: * should be writeable
073: *
074: * @exception IllegalArgumentException if name is null
075: * @exception IllegalStateException if this DynaClass is currently
076: * restricted, so no new properties can be added
077: */
078: public void add(String name, Class type, boolean readable,
079: boolean writeable);
080:
081: /**
082: * Is this DynaClass currently restricted, if so, no changes to the
083: * existing registration of property names, data types, readability, or
084: * writeability are allowed.
085: *
086: * @return <code>true</code> if this Mutable {@link DynaClass} is restricted,
087: * otherwise <code>false</code>
088: */
089: public boolean isRestricted();
090:
091: /**
092: * Remove the specified dynamic property, and any associated data type,
093: * readability, and writeability, from this dynamic class.
094: * <strong>NOTE</strong> - This does <strong>NOT</strong> cause any
095: * corresponding property values to be removed from DynaBean instances
096: * associated with this DynaClass.
097: *
098: * @param name Name of the dynamic property to remove
099: *
100: * @exception IllegalArgumentException if name is null
101: * @exception IllegalStateException if this DynaClass is currently
102: * restricted, so no properties can be removed
103: */
104: public void remove(String name);
105:
106: /**
107: * Set the restricted state of this DynaClass to the specified value.
108: *
109: * @param restricted The new restricted state
110: */
111: public void setRestricted(boolean restricted);
112:
113: }
|