001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.commons.betwixt.digester; 018 019 import java.util.Set; 020 021 import org.apache.commons.logging.Log; 022 import org.apache.commons.logging.LogFactory; 023 import org.xml.sax.Attributes; 024 import org.xml.sax.SAXException; 025 026 /** <p><code>HideRule</code> hides the property of the given name.</p> 027 * 028 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> 029 * @version $Revision: 438373 $ 030 */ 031 public class HideRule extends RuleSupport { 032 033 /** Logger */ 034 private static final Log log = LogFactory.getLog( HideRule.class ); 035 036 /** Base constructor */ 037 public HideRule() { 038 } 039 040 // Rule interface 041 //------------------------------------------------------------------------- 042 043 /** 044 * Process the beginning of this element. 045 * 046 * @param attributes The attribute list of this element 047 * @throws SAXException when the mandatory 'property' attribute is missing 048 */ 049 public void begin(String name, String namespace, Attributes attributes) throws SAXException { 050 String propertyAttributeValue = attributes.getValue( "property" ); 051 if ( propertyAttributeValue == null || propertyAttributeValue.length() == 0 ) { 052 throw new SAXException( 053 "<hide> element is missing the mandatory attribute 'property'" ); 054 } 055 Set propertySet = getProcessedPropertyNameSet(); 056 propertySet.add( propertyAttributeValue ); 057 } 058 }