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 018package org.apache.commons.jxpath; 019 020import java.beans.PropertyDescriptor; 021import java.io.Serializable; 022 023/** 024 * JXPathBeanInfo is similar to {@link java.beans.BeanInfo} in that it describes properties of a JavaBean class. By default, JXPathBeanInfo classes are 025 * automatically generated by {@link JXPathIntrospector JXPathIntrospector} based on the java.beans.BeanInfo. As with JavaBeans, the user can supply an 026 * alternative implementation of JXPathBeanInfo for a custom class. The alternative implementation is located by class name, which is the same as the name of 027 * the class it represents with the suffix "XBeanInfo". So, for example, if you need to provide an alternative JXPathBeanInfo class for class "com.foo.Bar", 028 * write a class "com.foo.BarXBeanInfo" and make it implement the JXPathBeanInfo interface. 029 */ 030public interface JXPathBeanInfo extends Serializable { 031 032 /** 033 * Gets the class implementing the {@link DynamicPropertyHandler} interface for dynamic objects. That class can be used to access dynamic properties. 034 * 035 * @return Class The class implementing the {@link DynamicPropertyHandler} interface. 036 */ 037 Class getDynamicPropertyHandlerClass(); 038 039 /** 040 * Gets a PropertyDescriptor for the specified name or null if there is no such property. 041 * 042 * @param propertyName property name 043 * @return PropertyDescriptor 044 */ 045 PropertyDescriptor getPropertyDescriptor(String propertyName); 046 047 /** 048 * Gets a list of property descriptors for the beans described by this bean info object. Returns null for atomic beans. 049 * 050 * @return PropertyDescriptor[] 051 */ 052 PropertyDescriptor[] getPropertyDescriptors(); 053 054 /** 055 * Tests whether objects of this class are treated as atomic objects which have no properties of their own. For example, {@link String} and {@link Number} 056 * are atomic. 057 * 058 * @return Tests whether objects of this class are treated as atomic objects. 059 */ 060 boolean isAtomic(); 061 062 /** 063 * Tests whether the objects of this class have dynamic properties (e.g. java.util.Map). If this method returns true, {@link #getPropertyDescriptors} should 064 * return null and {@link #getDynamicPropertyHandlerClass} should return a valid class name. An object cannot have both static and dynamic properties at the 065 * same time. 066 * 067 * @return whether the objects of this class have dynamic properties. 068 */ 069 boolean isDynamic(); 070}