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. import java.util.Set;
  18. import org.apache.commons.betwixt.XMLIntrospector;
  19. import org.apache.commons.digester.Rule;
  20. import org.apache.commons.logging.Log;
  21. import org.apache.commons.logging.LogFactory;
  22. /** <p><code>RuleSupport</code> is an abstract base class containing useful
  23. * helper methods.</p>
  24. *
  25. * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  26. * @version $Revision: 1.6 $
  27. */
  28. public class RuleSupport extends Rule {
  29. /** Logger */
  30. private static final Log log = LogFactory.getLog( RuleSupport.class );
  31. /** Base constructor */
  32. public RuleSupport() {
  33. }
  34. // Implementation methods
  35. //-------------------------------------------------------------------------
  36. /**
  37. * Gets <code>XMLBeanInfoDigester</code> using this rule.
  38. *
  39. * @return <code>XMLBeanInfoDigester</code> for this rule
  40. */
  41. protected XMLBeanInfoDigester getXMLInfoDigester() {
  42. return (XMLBeanInfoDigester) getDigester();
  43. }
  44. /**
  45. * Gets <code>XMLIntrospector</code> to be used for introspection
  46. *
  47. * @return <code>XMLIntrospector</code> to use
  48. */
  49. protected XMLIntrospector getXMLIntrospector() {
  50. return getXMLInfoDigester().getXMLIntrospector();
  51. }
  52. /**
  53. * Gets the class of the bean whose .betwixt file is being digested
  54. *
  55. * @return the <code>Class</code> of the bean being processed
  56. */
  57. protected Class getBeanClass() {
  58. return getXMLInfoDigester().getBeanClass();
  59. }
  60. /**
  61. * Gets the property names already processed
  62. *
  63. * @return the set of property names that have been processed so far
  64. */
  65. protected Set getProcessedPropertyNameSet() {
  66. return getXMLInfoDigester().getProcessedPropertyNameSet();
  67. }
  68. }