View Javadoc

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