View Javadoc

1   /*
2    *  Copyright 2001-2013 Stephen Colebourne
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.joda.beans;
17  
18  /**
19   * A dynamic bean that allows properties to be added and removed.
20   * <p>
21   * A JavaBean is defined at compile-time and cannot have additional properties added.
22   * Instances of this interface allow additional properties to be added and removed
23   * probably by wrapping a map
24   * 
25   * @author Stephen Colebourne
26   */
27  public interface DynamicBean extends Bean {
28  
29      /**
30       * Adds a property to those allowed to be stored in the bean.
31       * <p>
32       * Some implementations will automatically add properties, in which case this
33       * method will have no effect.
34       * 
35       * @param propertyName  the property name to check, not empty, not null
36       * @param propertyType  the property type, not null
37       */
38      void propertyDefine(String propertyName, Class<?> propertyType);
39  
40      /**
41       * Removes a property by name.
42       * 
43       * @param propertyName  the property name to remove, null ignored
44       */
45      void propertyRemove(String propertyName);
46  
47  }