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: * Creates a "shadow" of a property of an object. The shadow has the same type as the property, and
19: * delegates all method invocations to the property. Each method invocation on the shadow
20: * re-acquires the value of the property from the underlying object and delegates to the current
21: * value of the property.
22: * <p>
23: * Typically, the object in question is another service, one with the "perthread" service lifecycle.
24: * This allows a global singleton to shadow a value that is specific to the current thread (and
25: * therefore, the current request).
26: *
27: *
28: */
29: public interface PropertyShadowBuilder {
30: /**
31: * @param <T>
32: * @param source
33: * the object from which a property will be extracted
34: * @param propertyName
35: * the name of a property of the object, which must be readable
36: * @param propertyType
37: * the expected type of the property, the actual property type must be assignable to
38: * this type
39: * @return the shadow
40: */
41: <T> T build(Object source, String propertyName,
42: Class<T> propertyType);
43: }
|