001 /*
002 * Copyright 2001-2013 Stephen Colebourne
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.joda.beans;
017
018 /**
019 * A dynamic bean that allows properties to be added and removed.
020 * <p>
021 * A JavaBean is defined at compile-time and cannot have additional properties added.
022 * Instances of this interface allow additional properties to be added and removed
023 * probably by wrapping a map
024 *
025 * @author Stephen Colebourne
026 */
027 public interface DynamicBean extends Bean {
028
029 /**
030 * Adds a property to those allowed to be stored in the bean.
031 * <p>
032 * Some implementations will automatically add properties, in which case this
033 * method will have no effect.
034 *
035 * @param propertyName the property name to check, not empty, not null
036 * @param propertyType the property type, not null
037 */
038 void propertyDefine(String propertyName, Class<?> propertyType);
039
040 /**
041 * Removes a property by name.
042 *
043 * @param propertyName the property name to remove, null ignored
044 */
045 void propertyRemove(String propertyName);
046
047 }