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