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