|
What this is
Other links
The source code/* * Copyright 1999-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jxpath; import java.util.Date; import java.util.Map; import java.util.HashMap; /** * JXPathIntrospector maintains a registry of {@link JXPathBeanInfo * JXPathBeanInfo} objects for Java classes. * * @author Dmitri Plotnikov * @version $Revision: 1.10 $ $Date: 2004/05/08 15:10:05 $ */ public class JXPathIntrospector { private static HashMap byClass = new HashMap(); private static HashMap byInterface = new HashMap(); static { registerAtomicClass(Class.class); registerAtomicClass(Boolean.TYPE); registerAtomicClass(Boolean.class); registerAtomicClass(Byte.TYPE); registerAtomicClass(Byte.class); registerAtomicClass(Character.TYPE); registerAtomicClass(Character.class); registerAtomicClass(Short.TYPE); registerAtomicClass(Short.class); registerAtomicClass(Integer.TYPE); registerAtomicClass(Integer.class); registerAtomicClass(Long.TYPE); registerAtomicClass(Long.class); registerAtomicClass(Float.TYPE); registerAtomicClass(Float.class); registerAtomicClass(Double.TYPE); registerAtomicClass(Double.class); registerAtomicClass(String.class); registerAtomicClass(Date.class); registerAtomicClass(java.sql.Date.class); registerAtomicClass(java.sql.Time.class); registerAtomicClass(java.sql.Timestamp.class); registerDynamicClass(Map.class, MapDynamicPropertyHandler.class); } /** * Automatically creates and registers a JXPathBeanInfo object * for the specified class. That object returns true to isAtomic(). */ public static void registerAtomicClass(Class beanClass) { byClass.put(beanClass, new JXPathBasicBeanInfo(beanClass, true)); } /** * Automatically creates and registers a JXPathBeanInfo object * for the specified class. That object returns true to isDynamic(). */ public static void registerDynamicClass( Class beanClass, Class dynamicPropertyHandlerClass) { JXPathBasicBeanInfo bi = new JXPathBasicBeanInfo(beanClass, dynamicPropertyHandlerClass); if (beanClass.isInterface()) { byInterface.put(beanClass, bi); } else { byClass.put(beanClass, bi); } } /** * Creates and registers a JXPathBeanInfo object for the supplied class. If * the class has already been registered, returns the registered * JXPathBeanInfo object. *
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.