01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.commons.betwixt.digester;
18:
19: import java.util.Set;
20:
21: import org.apache.commons.betwixt.XMLIntrospector;
22: import org.apache.commons.digester.Rule;
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25:
26: /** <p><code>RuleSupport</code> is an abstract base class containing useful
27: * helper methods.</p>
28: *
29: * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
30: * @version $Revision: 438373 $
31: */
32: public class RuleSupport extends Rule {
33:
34: /** Logger */
35: private static final Log log = LogFactory.getLog(RuleSupport.class);
36:
37: /** Base constructor */
38: public RuleSupport() {
39: }
40:
41: // Implementation methods
42: //-------------------------------------------------------------------------
43: /**
44: * Gets <code>XMLBeanInfoDigester</code> using this rule.
45: *
46: * @return <code>XMLBeanInfoDigester</code> for this rule
47: */
48: protected XMLBeanInfoDigester getXMLInfoDigester() {
49: return (XMLBeanInfoDigester) getDigester();
50: }
51:
52: /**
53: * Gets <code>XMLIntrospector</code> to be used for introspection
54: *
55: * @return <code>XMLIntrospector</code> to use
56: */
57: protected XMLIntrospector getXMLIntrospector() {
58: return getXMLInfoDigester().getXMLIntrospector();
59: }
60:
61: /**
62: * Gets the class of the bean whose .betwixt file is being digested
63: *
64: * @return the <code>Class</code> of the bean being processed
65: */
66: protected Class getBeanClass() {
67: return getXMLInfoDigester().getBeanClass();
68: }
69:
70: /**
71: * Gets the property names already processed
72: *
73: * @return the set of property names that have been processed so far
74: */
75: protected Set getProcessedPropertyNameSet() {
76: return getXMLInfoDigester().getProcessedPropertyNameSet();
77: }
78: }
|