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.logging.Log;
  19. import org.apache.commons.logging.LogFactory;
  20. import org.xml.sax.Attributes;
  21. import org.xml.sax.SAXException;
  22. /** <p><code>HideRule</code> hides the property of the given name.</p>
  23. *
  24. * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  25. * @version $Revision: 1.9 $
  26. */
  27. public class HideRule extends RuleSupport {
  28. /** Logger */
  29. private static final Log log = LogFactory.getLog( HideRule.class );
  30. /** Base constructor */
  31. public HideRule() {
  32. }
  33. // Rule interface
  34. //-------------------------------------------------------------------------
  35. /**
  36. * Process the beginning of this element.
  37. *
  38. * @param attributes The attribute list of this element
  39. * @throws SAXException when the mandatory 'property' attribute is missing
  40. */
  41. public void begin(String name, String namespace, Attributes attributes) throws SAXException {
  42. String propertyAttributeValue = attributes.getValue( "property" );
  43. if ( propertyAttributeValue == null || propertyAttributeValue.length() == 0 ) {
  44. throw new SAXException(
  45. "<hide> element is missing the mandatory attribute 'property'" );
  46. }
  47. Set propertySet = getProcessedPropertyNameSet();
  48. propertySet.add( propertyAttributeValue );
  49. }
  50. }