01: // Copyright 2006 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.ioc.services;
16:
17: /**
18: * A wrapper around the JavaBean Introspector that allows more manageable access to JavaBean
19: * properties of objects.
20: *
21: * <p>
22: * Only provides access to <em>simple</em> properties. Indexed properties are ignored.
23: */
24: public interface PropertyAccess {
25: /**
26: * Reads the value of a property.
27: *
28: * @throws UnsupportedOperationException
29: * if the property is write only
30: * @throws IllegalArgumentException
31: * if property does not exist
32: */
33: Object get(Object instance, String propertyName);
34:
35: /**
36: * Updates the value of a property.
37: *
38: * @throws UnsupportedOperationException
39: * if the property is read only
40: * @throws IllegalArgumentException
41: * if property does not exist
42: */
43: void set(Object instance, String propertyName, Object value);
44:
45: /**
46: * Returns the adapter for a particular object instance. A convienience over invoking
47: * {@link #getAdapter(Class)}.
48: */
49: ClassPropertyAdapter getAdapter(Object instance);
50:
51: /**
52: * Returns the adapter used to access properties within the indicated class.
53: */
54: ClassPropertyAdapter getAdapter(Class forClass);
55:
56: /** Discards all stored property access information, discarding all created class adapters. */
57: void clearCache();
58: }
|