KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > digester > HideRule


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 JavaDoc;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.xml.sax.Attributes JavaDoc;
23 import org.xml.sax.SAXException JavaDoc;
24
25 /** <p><code>HideRule</code> hides the property of the given name.</p>
26   *
27   * @author <a HREF="mailto:jstrachan@apache.org">James Strachan</a>
28   * @version $Revision: 1.9 $
29   */

30 public class HideRule extends RuleSupport {
31
32     /** Logger */
33     private static final Log log = LogFactory.getLog( HideRule.class );
34     
35     /** Base constructor */
36     public HideRule() {
37     }
38     
39     // Rule interface
40
//-------------------------------------------------------------------------
41

42     /**
43      * Process the beginning of this element.
44      *
45      * @param attributes The attribute list of this element
46      * @throws SAXException when the mandatory 'property' attribute is missing
47      */

48     public void begin(String JavaDoc name, String JavaDoc namespace, Attributes JavaDoc attributes) throws SAXException JavaDoc {
49         String JavaDoc propertyAttributeValue = attributes.getValue( "property" );
50         if ( propertyAttributeValue == null || propertyAttributeValue.length() == 0 ) {
51             throw new SAXException JavaDoc(
52                 "<hide> element is missing the mandatory attribute 'property'" );
53         }
54         Set JavaDoc propertySet = getProcessedPropertyNameSet();
55         propertySet.add( propertyAttributeValue );
56     }
57 }
58
Popular Tags