KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > parse > BeanSetPropertySetter


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// 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.parse;
16
17 import org.apache.hivemind.impl.BaseLocatable;
18 import org.apache.tapestry.bean.BindingBeanInitializer;
19 import org.apache.tapestry.spec.IBeanSpecification;
20
21 /**
22  * Holds the data from a <set-property> element while the body is being parsed.
23  *
24  * @author Howard Lewis Ship
25  */

26 class BeanSetPropertySetter extends BaseLocatable
27 {
28     private IBeanSpecification _beanSpecification;
29
30     private BindingBeanInitializer _initializer;
31
32     private String JavaDoc _bindingReference;
33
34     private String JavaDoc _prefix;
35
36     BeanSetPropertySetter(IBeanSpecification beanSpecification, BindingBeanInitializer initializer,
37             String JavaDoc prefix, String JavaDoc expression)
38     {
39         _beanSpecification = beanSpecification;
40         _initializer = initializer;
41         _prefix = prefix;
42         _bindingReference = expression;
43     }
44
45     void applyBindingReference(String JavaDoc bindingReference)
46     {
47         String JavaDoc fullBindingReference = _prefix == null ? bindingReference : _prefix
48                 + bindingReference;
49
50         _initializer.setBindingReference(fullBindingReference);
51
52         _beanSpecification.setLocation(getLocation());
53         _beanSpecification.addInitializer(_initializer);
54     }
55
56     public String JavaDoc getBindingReference()
57     {
58         return _bindingReference;
59     }
60
61 }
Popular Tags