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 */
017package org.apache.commons.beanutils2;
018
019import java.beans.IntrospectionException;
020
021/**
022 * <p>
023 * Definition of an interface for components that can perform introspection on bean classes.
024 * </p>
025 * <p>
026 * Before {@link PropertyUtils} can be used for interaction with a specific Java class, the class's properties have to be determined. This is called
027 * <em>introspection</em> and is initiated automatically on demand. {@code PropertyUtils} does not perform introspection on its own, but delegates this task to
028 * one or more objects implementing this interface. This makes it possible to customize introspection which may be useful for certain code bases using
029 * non-standard conventions for accessing properties.
030 * </p>
031 *
032 * @since 1.9
033 */
034public interface BeanIntrospector {
035
036    /**
037     * Performs introspection on a Java class. The current class to be inspected can be queried from the passed in {@code IntrospectionContext} object. A
038     * typical implementation has to obtain this class, determine its properties according to the rules it implements, and add them to the passed in context
039     * object.
040     *
041     * @param icontext the context object for interaction with the initiator of the introspection request
042     * @throws IntrospectionException if an error occurs during introspection
043     */
044    void introspect(IntrospectionContext icontext) throws IntrospectionException;
045}