KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > BeanWrapper


1 /*
2  * Copyright 2002-2007 the original author or authors.
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
17 package org.springframework.beans;
18
19 import java.beans.PropertyDescriptor JavaDoc;
20
21 /**
22  * The central interface of Spring's low-level JavaBeans infrastructure.
23  *
24  * <p>Typically not used directly but rather implicitly via a
25  * {@link org.springframework.beans.factory.BeanFactory} or a
26  * {@link org.springframework.validation.DataBinder}.
27  *
28  * <p>Provides operations to analyze and manipulate standard JavaBeans:
29  * the ability to get and set property values (individually or in bulk),
30  * get property descriptors, and query the readability/writability of properties.
31  *
32  * <p>This interface supports <b>nested properties</b> enabling the setting
33  * of properties on subproperties to an unlimited depth.
34  * A <code>BeanWrapper</code> instance can be used repeatedly, with its
35  * {@link #setWrappedInstance(Object) target object} (the wrapped JavaBean
36  * instance) changing as required.
37  *
38  * <p>A BeanWrapper's default for the "extractOldValueForEditor" setting
39  * is "false", to avoid side effects caused by getter method invocations.
40  * Turn this to "true" to expose present property values to custom editors.
41  *
42  * @author Rod Johnson
43  * @author Juergen Hoeller
44  * @since 13 April 2001
45  * @see #setExtractOldValueForEditor
46  * @see PropertyAccessor
47  * @see PropertyEditorRegistry
48  * @see BeanWrapperImpl
49  * @see org.springframework.beans.factory.BeanFactory
50  * @see org.springframework.validation.BeanPropertyBindingResult
51  * @see org.springframework.validation.DataBinder#initBeanPropertyAccess()
52  */

53 public interface BeanWrapper extends ConfigurablePropertyAccessor, TypeConverter {
54
55     /**
56      * Change the wrapped JavaBean object.
57      * @param obj the bean instance to wrap
58      */

59     void setWrappedInstance(Object JavaDoc obj);
60
61     /**
62      * Return the bean instance wrapped by this object, if any.
63      * @return the bean instance, or <code>null</code> if none set
64      */

65     Object JavaDoc getWrappedInstance();
66
67     /**
68      * Return the type of the wrapped JavaBean object.
69      * @return the type of the wrapped bean instance,
70      * or <code>null</code> if no wrapped object has been set
71      */

72     Class JavaDoc getWrappedClass();
73
74     /**
75      * Obtain the PropertyDescriptors for the wrapped object
76      * (as determined by standard JavaBeans introspection).
77      * @return the PropertyDescriptors for the wrapped object
78      */

79     PropertyDescriptor JavaDoc[] getPropertyDescriptors();
80
81     /**
82      * Obtain the property descriptor for a specific property
83      * of the wrapped object.
84      * @param propertyName the property to obtain the descriptor for
85      * (may be a nested path, but no indexed/mapped property)
86      * @return the property descriptor for the specified property
87      * @throws InvalidPropertyException if there is no such property
88      */

89     PropertyDescriptor JavaDoc getPropertyDescriptor(String JavaDoc propertyName) throws BeansException;
90
91 }
92
Popular Tags