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.HashMap;
020 import java.util.Map;
021
022 /**
023 * <code>XMLSingleMappingFileBeanInfoDigester</code> is a digester of XML files
024 * containing XMLBeanInfo definitions for a JavaBeans.
025 *
026 * @since 0.7
027 * @author Brian Pugh
028 */
029 public class MultiMappingBeanInfoDigester extends XMLBeanInfoDigester {
030 /** <code>XMLBeanInfo</code>'s indexed by <code>Class</code> */
031 private Map beanInfoMap = new HashMap();
032
033 // Implementation methods
034 //-------------------------------------------------------------------------
035 /**
036 * Reset configure for new digestion.
037 */
038 protected void configure() {
039 if (!configured) {
040 configured = true;
041
042 // add the various rules
043 addRule("betwixt-config", new ConfigRule());
044 addRule("betwixt-config/class", new ClassRule());
045 addRuleSet(new CommonRuleSet());
046 }
047
048 // now initialize
049 //setAttributesForPrimitives(true);
050 getProcessedPropertyNameSet().clear();
051 getXMLIntrospector().getRegistry().flush();
052 }
053
054 /**
055 * Map containing <code>XMLBeanInfo</code> classes.
056 * Keys are the <code>Class</code> and values are the <code>XMLBeanInfo</code> objects.
057 *
058 * @return map of XMLBeanInfos
059 */
060 public Map getBeanInfoMap() {
061 return beanInfoMap;
062 }
063
064 /**
065 * Set the Map containing <code>XMLBeanInfo</code> classes.
066 * @param beanInfoMap map to set.
067 */
068 public void setBeanInfoMap(Map beanInfoMap) {
069 this.beanInfoMap = beanInfoMap;
070 }
071
072 }