1
2
3 package org.virtualmock.configuration;
4
5 import java.util.ArrayList;
6 import java.util.List;
7 import org.xml.sax.SAXException;
8 import org.xml.sax.helpers.DefaultHandler;
9
10
11 /***
12 * DefaultHandler for VirtualMock RuleConfigs.
13 *
14 * @author Property Systems Development
15 * @version $Revision: 1.1 $
16 */
17 public class ExcludedClassesHandler extends DefaultHandler {
18 private List classExclusionPatterns = new ArrayList();
19 private String characters = null;
20 private String exclusionPattern = null;
21
22 /***
23 * Returns a List representing the classExclusionPatterns defined in the
24 * configuration file.
25 *
26 * @return Returns a List representing the classExclusionPatterns defined
27 * in the configuration file.
28 */
29 public List getClassExclusionPatterns() {
30 return classExclusionPatterns;
31 }
32
33 /***
34 * Overridden SAX event.
35 *
36 * @param buffer the buffer
37 * @param offset the offset
38 * @param len the length
39 *
40 * @throws SAXException Any SAXException
41 */
42 public void characters(char[] buffer, int offset, int len)
43 throws SAXException {
44 characters = new String(buffer, offset, len);
45 }
46
47 /***
48 * Overridden SAX event.
49 *
50 * @param uri the uri
51 * @param localName the local name
52 * @param name the name
53 */
54 public void endElement(String uri, String localName, String name) {
55 Integer enforcementLevel = null;
56
57 if (name.equals("exclusion-pattern")) {
58 exclusionPattern = characters;
59 } else if (name.equals("excluded-classes")) {
60 classExclusionPatterns.add(exclusionPattern);
61 }
62 }
63 }