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: import java.util.List;
18:
19: /**
20: * Organizes all {@link org.apache.tapestry.ioc.services.PropertyAdapter}s for a particular class.
21: * <p>
22: * Only provides access to <em>simple</em> properties. Indexed properties are ignored.
23: * <p>
24: * When acessing properties by name, the case of the name is ignored.
25: */
26: public interface ClassPropertyAdapter {
27: /** Returns the names of all properties, sorted into alphabetic order. */
28: List<String> getPropertyNames();
29:
30: /** Returns the type of bean this adapter provides properties for. */
31: Class getBeanType();
32:
33: /**
34: * Returns the property adapter with the given name, or null if no such adapter exists.
35: *
36: * @param name
37: * of the property (case is ignored)
38: */
39: PropertyAdapter getPropertyAdapter(String name);
40:
41: /**
42: * Reads the value of a property.
43: *
44: * @param instance
45: * the object to read a value from
46: * @param propertyName
47: * the name of the property to read (case is ignored)
48: * @throws UnsupportedOperationException
49: * if the property is write only
50: * @throws IllegalArgumentException
51: * if property does not exist
52: */
53: Object get(Object instance, String propertyName);
54:
55: /**
56: * Updates the value of a property.
57: *
58: * @param instance
59: * the object to update
60: * @param propertyName
61: * the name of the property to update (case is ignored)
62: * @throws UnsupportedOperationException
63: * if the property is read only
64: * @throws IllegalArgumentException
65: * if property does not exist
66: */
67: void set(Object instance, String propertyName, Object value);
68: }
|