Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
MultiMappingBeanInfoDigester |
|
| 1.3333333333333333;1.333 |
1 | /* |
|
2 | * Copyright 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.HashMap; |
|
19 | import java.util.Map; |
|
20 | ||
21 | /** |
|
22 | * <code>XMLSingleMappingFileBeanInfoDigester</code> is a digester of XML files |
|
23 | * containing XMLBeanInfo definitions for a JavaBeans. |
|
24 | * |
|
25 | * @since 0.7 |
|
26 | * @author Brian Pugh |
|
27 | */ |
|
28 | 830 | public class MultiMappingBeanInfoDigester extends XMLBeanInfoDigester { |
29 | /** <code>XMLBeanInfo</code>'s indexed by <code>Class</code> */ |
|
30 | 415 | private Map beanInfoMap = new HashMap(); |
31 | ||
32 | // Implementation methods |
|
33 | //------------------------------------------------------------------------- |
|
34 | /** |
|
35 | * Reset configure for new digestion. |
|
36 | */ |
|
37 | protected void configure() { |
|
38 | 830 | if (!configured) { |
39 | 415 | configured = true; |
40 | ||
41 | // add the various rules |
|
42 | 415 | addRule("betwixt-config", new ConfigRule()); |
43 | 415 | addRule("betwixt-config/class", new ClassRule()); |
44 | 415 | addRuleSet(new CommonRuleSet()); |
45 | } |
|
46 | ||
47 | // now initialize |
|
48 | //setAttributesForPrimitives(true); |
|
49 | 830 | getProcessedPropertyNameSet().clear(); |
50 | 830 | getXMLIntrospector().getRegistry().flush(); |
51 | 830 | } |
52 | ||
53 | /** |
|
54 | * Map containing <code>XMLBeanInfo</code> classes. |
|
55 | * Keys are the <code>Class</code> and values are the <code>XMLBeanInfo</code> objects. |
|
56 | * |
|
57 | * @return map of XMLBeanInfos |
|
58 | */ |
|
59 | public Map getBeanInfoMap() { |
|
60 | 1947 | return beanInfoMap; |
61 | } |
|
62 | ||
63 | /** |
|
64 | * Set the Map containing <code>XMLBeanInfo</code> classes. |
|
65 | * @param beanInfoMap map to set. |
|
66 | */ |
|
67 | public void setBeanInfoMap(Map beanInfoMap) { |
|
68 | 0 | this.beanInfoMap = beanInfoMap; |
69 | 0 | } |
70 | ||
71 | } |