View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  package org.apache.commons.betwixt.digester;
17  
18  import java.util.Set;
19  
20  import org.apache.commons.betwixt.XMLIntrospector;
21  import org.apache.commons.digester.Rule;
22  import org.apache.commons.logging.Log;
23  import org.apache.commons.logging.LogFactory;
24  
25  /*** <p><code>RuleSupport</code> is an abstract base class containing useful
26    * helper methods.</p>
27    *
28    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
29    * @version $Revision: 1.6 $
30    */
31  public class RuleSupport extends Rule {
32  
33      /*** Logger */
34      private static final Log log = LogFactory.getLog( RuleSupport.class );
35      /*** Base constructor */
36      public RuleSupport() {
37      }
38      
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  }