View Javadoc
1 package org.apache.commons.betwixt.registry; 2 3 /* 4 * ==================================================================== 5 * 6 * The Apache Software License, Version 1.1 7 * 8 * Copyright (c) 1999-2002 The Apache Software Foundation. All rights 9 * reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in 20 * the documentation and/or other materials provided with the 21 * distribution. 22 * 23 * 3. The end-user documentation included with the redistribution, if 24 * any, must include the following acknowlegement: 25 * "This product includes software developed by the 26 * Apache Software Foundation (http://www.apache.org/)." 27 * Alternately, this acknowlegement may appear in the software itself, 28 * if and wherever such third-party acknowlegements normally appear. 29 * 30 * 4. The names "The Jakarta Project", "Commons", and "Apache Software 31 * Foundation" must not be used to endorse or promote products derived 32 * from this software without prior written permission. For written 33 * permission, please contact apache@apache.org. 34 * 35 * 5. Products derived from this software may not be called "Apache" 36 * nor may "Apache" appear in their names without prior written 37 * permission of the Apache Group. 38 * 39 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 40 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 41 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 42 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 45 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 46 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 47 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 48 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 49 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * SUCH DAMAGE. 51 * ==================================================================== 52 * 53 * This software consists of voluntary contributions made by many 54 * individuals on behalf of the Apache Software Foundation. For more 55 * information on the Apache Software Foundation, please see 56 * <http://www.apache.org/>;. 57 */ 58 59 import java.util.HashMap; 60 import java.util.Map; 61 62 import org.apache.commons.betwixt.XMLBeanInfo; 63 64 /*** The default caching implementation. 65 * A hashmap is used. 66 * 67 * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a> 68 * @version $Id: DefaultXMLBeanInfoRegistry.java,v 1.3 2003/01/06 22:50:44 rdonkin Exp $ 69 */ 70 public class DefaultXMLBeanInfoRegistry implements XMLBeanInfoRegistry { 71 72 /*** Used to associated <code>XMLBeanInfo</code>'s to classes */ 73 private Map xmlBeanInfos = new HashMap(); 74 75 /*** 76 * Get <code>XMLBeanInfo</code> from cache. 77 * 78 * @param forThisClass the class for which to find a <code>XMLBeanInfo</code> 79 * @return cached <code>XMLBeanInfo</code> associated with given class 80 * or <code>null</code> if no <code>XMLBeanInfo</code> has been associated 81 */ 82 public XMLBeanInfo get(Class forThisClass) { 83 return (XMLBeanInfo) xmlBeanInfos.get(forThisClass); 84 } 85 86 /*** 87 * Put into cache 88 * 89 * @param forThisClass the class to cache the <code>XMLBeanInfo</code> for 90 * @param beanInfo the <code>XMLBeanInfo</code> to cache 91 */ 92 public void put(Class forThisClass, XMLBeanInfo beanInfo) { 93 xmlBeanInfos.put(forThisClass, beanInfo); 94 } 95 96 /*** 97 * Flush existing cached <code>XMLBeanInfo</code>'s. 98 */ 99 public void flush() { 100 xmlBeanInfos.clear(); 101 } 102 }

This page was automatically generated by Maven