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  package org.apache.commons.beanutils;
18  
19  import java.beans.IntrospectionException;
20  
21  /**
22   * <p>
23   * Definition of an interface for components that can perform introspection on
24   * bean classes.
25   * </p>
26   * <p>
27   * Before {@link PropertyUtils} can be used for interaction with a specific Java
28   * class, the class's properties have to be determined. This is called
29   * <em>introspection</em> and is initiated automatically on demand.
30   * <code>PropertyUtils</code> does not perform introspection on its own, but
31   * delegates this task to one or more objects implementing this interface. This
32   * makes it possible to customize introspection which may be useful for certain
33   * code bases using non-standard conventions for accessing properties.
34   * </p>
35   *
36   * @version $Id$
37   * @since 1.9
38   */
39  public interface BeanIntrospector {
40      /**
41       * Performs introspection on a Java class. The current class to be inspected
42       * can be queried from the passed in <code>IntrospectionContext</code>
43       * object. A typical implementation has to obtain this class, determine its
44       * properties according to the rules it implements, and add them to the
45       * passed in context object.
46       *
47       * @param icontext the context object for interaction with the initiator of
48       *        the introspection request
49       * @throws IntrospectionException if an error occurs during introspection
50       */
51      void introspect(IntrospectionContext icontext)
52              throws IntrospectionException;
53  }