Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
HideRule |
|
| 2.0;2 |
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.logging.Log; |
|
21 | import org.apache.commons.logging.LogFactory; |
|
22 | import org.xml.sax.Attributes; |
|
23 | import org.xml.sax.SAXException; |
|
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: 155402 $ |
|
29 | */ |
|
30 | 604 | public class HideRule extends RuleSupport { |
31 | ||
32 | /** Logger */ |
|
33 | 604 | private static final Log log = LogFactory.getLog( HideRule.class ); |
34 | ||
35 | /** Base constructor */ |
|
36 | 1624 | public HideRule() { |
37 | 1624 | } |
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 name, String namespace, Attributes attributes) throws SAXException { |
|
49 | 13 | String propertyAttributeValue = attributes.getValue( "property" ); |
50 | 13 | if ( propertyAttributeValue == null || propertyAttributeValue.length() == 0 ) { |
51 | 0 | throw new SAXException( |
52 | 0 | "<hide> element is missing the mandatory attribute 'property'" ); |
53 | } |
|
54 | 13 | Set propertySet = getProcessedPropertyNameSet(); |
55 | 13 | propertySet.add( propertyAttributeValue ); |
56 | 13 | } |
57 | } |