View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.jxpath;
19  
20  import java.beans.PropertyDescriptor;
21  import java.io.Serializable;
22  
23  /**
24   * JXPathBeanInfo is similar to {@link java.beans.BeanInfo} in that it describes properties of a JavaBean class. By default, JXPathBeanInfo classes are
25   * automatically generated by {@link JXPathIntrospector JXPathIntrospector} based on the java.beans.BeanInfo. As with JavaBeans, the user can supply an
26   * alternative implementation of JXPathBeanInfo for a custom class. The alternative implementation is located by class name, which is the same as the name of
27   * 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",
28   * write a class "com.foo.BarXBeanInfo" and make it implement the JXPathBeanInfo interface.
29   */
30  public interface JXPathBeanInfo extends Serializable {
31  
32      /**
33       * Gets the class implementing the {@link DynamicPropertyHandler} interface for dynamic objects. That class can be used to access dynamic properties.
34       *
35       * @return Class The class implementing the {@link DynamicPropertyHandler} interface.
36       */
37      Class getDynamicPropertyHandlerClass();
38  
39      /**
40       * Gets a PropertyDescriptor for the specified name or null if there is no such property.
41       *
42       * @param propertyName property name
43       * @return PropertyDescriptor
44       */
45      PropertyDescriptor getPropertyDescriptor(String propertyName);
46  
47      /**
48       * Gets a list of property descriptors for the beans described by this bean info object. Returns null for atomic beans.
49       *
50       * @return PropertyDescriptor[]
51       */
52      PropertyDescriptor[] getPropertyDescriptors();
53  
54      /**
55       * 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}
56       * are atomic.
57       *
58       * @return Tests whether objects of this class are treated as atomic objects.
59       */
60      boolean isAtomic();
61  
62      /**
63       * Tests whether the objects of this class have dynamic properties (e.g. java.util.Map). If this method returns true, {@link #getPropertyDescriptors} should
64       * return null and {@link #getDynamicPropertyHandlerClass} should return a valid class name. An object cannot have both static and dynamic properties at the
65       * same time.
66       *
67       * @return whether the objects of this class have dynamic properties.
68       */
69      boolean isDynamic();
70  }