|
Commons JXPath example source code file (JXPathIntrospector.java)
The Commons JXPath JXPathIntrospector.java source code/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
*/
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().
* @param beanClass to register
*/
public static void registerAtomicClass(Class beanClass) {
byClass.put(beanClass, new JXPathBasicBeanInfo(beanClass, true));
}
/**
* Automatically creates and registers a {@link JXPathBeanInfo} object
* for the specified class. That object returns true to
* {@link JXPathBeanInfo#isDynamic()}.
*
* @param beanClass to register
* @param dynamicPropertyHandlerClass to handle beanClass
*/
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.
* <p>
* The process of creation of JXPathBeanInfo is as follows:
* <ul>
* <li>If class named
Other Commons JXPath examples (source code examples)Here is a short list of links related to this Commons JXPath JXPathIntrospector.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.