# Introspector

public class **Introspector** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
The `Introspector` is a utility for developers to figure out
which properties, events, and methods a JavaBean supports.


The `Introspector` class walks over the class/superclass chain
of the target bean class. At each level it checks if there is a matching
`BeanInfo` class which provides explicit information about the
bean, and if so uses that explicit information. Otherwise it uses the low
level reflection APIs to study the target class and uses design patterns to
analyze its behaviour and then proceeds to continue the introspection with
its baseclass.


To look for the explicit information of a bean:

1. The `Introspector` appends "BeanInfo" to the qualified name of the bean class, try to use the new class as the "BeanInfo" class. If the "BeanInfo" class exsits and returns non-null value when queried for explicit information, use the explicit information
2. If the first step fails, the `Introspector` will extract a simple class name of the bean class by removing the package name from the qualified name of the bean class, append "BeanInfo" to it. And look for the simple class name in the packages defined in the "BeanInfo" search path (The default "BeanInfo" search path is `sun.beans.infos`). If it finds a "BeanInfo" class and the "BeanInfo" class returns non-null value when queried for explicit information, use the explicit information

<br />

### Constant Summary

|---|---|---|
| int | [IGNORE_ALL_BEANINFO](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#IGNORE_ALL_BEANINFO) | Constant values to indicate that the `Introspector` will ignore all `BeanInfo` class. |
| int | [IGNORE_IMMEDIATE_BEANINFO](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#IGNORE_IMMEDIATE_BEANINFO) | Constant values to indicate that the `Introspector` will ignore the `BeanInfo` class of the current bean class. |
| int | [USE_ALL_BEANINFO](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#USE_ALL_BEANINFO) | Constant values to indicate that the `Introspector` will use all `BeanInfo` class which have been found. |

### Public Method Summary

|---|---|
| static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [decapitalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#decapitalize(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Decapitalizes a given string according to the rule: - If the first or only character is Upper Case, it is made Lower Case - UNLESS the second character is also Upper Case, when the String is returned unchanged |
| static void | [flushCaches](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#flushCaches())() Flushes all `BeanInfo` caches. |
| static void | [flushFromCaches](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#flushFromCaches(java.lang.Class<?>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> clazz) Flushes the `BeanInfo` caches of the specified bean class |
| static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html) | [getBeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#getBeanInfo(java.lang.Class<?>,%20java.lang.Class<?>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass, [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> stopClass) Gets the `BeanInfo` object which contains the information of the properties, events and methods of the specified bean class. |
| static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html) | [getBeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#getBeanInfo(java.lang.Class<?>,%20int))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass, int flags) Gets the `BeanInfo` object which contains the information of the properties, events and methods of the specified bean class. |
| static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html) | [getBeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#getBeanInfo(java.lang.Class<?>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass) Gets the `BeanInfo` object which contains the information of the properties, events and methods of the specified bean class. |
| static [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getBeanInfoSearchPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#getBeanInfoSearchPath())() Gets an array of search packages. |
| static void | [setBeanInfoSearchPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/Introspector.html#setBeanInfoSearchPath(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) path) Sets the search packages. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Constants

#### public static final int
**IGNORE_ALL_BEANINFO**

Constant values to indicate that the `Introspector` will
ignore all `BeanInfo` class.
Constant Value: 3

#### public static final int
**IGNORE_IMMEDIATE_BEANINFO**

Constant values to indicate that the `Introspector` will
ignore the `BeanInfo` class of the current bean class.
Constant Value: 2

#### public static final int
**USE_ALL_BEANINFO**

Constant values to indicate that the `Introspector` will use
all `BeanInfo` class which have been found. This is the default one.
Constant Value: 1

## Public Methods

#### public static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**decapitalize**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Decapitalizes a given string according to the rule:

- If the first or only character is Upper Case, it is made Lower Case
- UNLESS the second character is also Upper Case, when the String is returned unchanged <br />

##### Parameters

| name | - the String to decapitalize |
|---|---|

##### Returns

- the decapitalized version of the String

#### public static void
**flushCaches**
()

Flushes all `BeanInfo` caches.

#### public static void
**flushFromCaches**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> clazz)

Flushes the `BeanInfo` caches of the specified bean class

##### Parameters

| clazz | the specified bean class |
|---|---|

#### public static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html)
**getBeanInfo**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass, [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> stopClass)

Gets the `BeanInfo` object which contains the information of
the properties, events and methods of the specified bean class. It will
not introspect the "stopclass" and its super class.


The `Introspector` will cache the `BeanInfo`
object. Subsequent calls to this method will be answered with the cached
data.

<br />

##### Parameters

| beanClass | the specified beanClass. |
| stopClass | the sopt class which should be super class of the bean class. May be null. |
|---|---|

##### Returns

- the `BeanInfo` of the bean class.

##### Throws

| [IntrospectionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/IntrospectionException.html) |   |
|---|---|

#### public static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html)
**getBeanInfo**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass, int flags)

Gets the `BeanInfo` object which contains the information of
the properties, events and methods of the specified bean class.

1. If `flag==IGNORE_ALL_BEANINFO`, the `Introspector` will ignore all `BeanInfo` class.
2. If `flag==IGNORE_IMMEDIATE_BEANINFO`, the `Introspector` will ignore the `BeanInfo` class of the current bean class.
3. If `flag==USE_ALL_BEANINFO`, the `Introspector` will use all `BeanInfo` class which have been found.


The `Introspector` will cache the `BeanInfo`
object. Subsequent calls to this method will be answered with the cached
data.

<br />

##### Parameters

| beanClass | the specified bean class. |
| flags | the flag to control the usage of the explicit `BeanInfo` class. |
|---|---|

##### Returns

- the `BeanInfo` of the bean class.

##### Throws

| [IntrospectionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/IntrospectionException.html) |   |
|---|---|

#### public static [BeanInfo](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/BeanInfo.html)
**getBeanInfo**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> beanClass)

Gets the `BeanInfo` object which contains the information of
the properties, events and methods of the specified bean class.


The `Introspector` will cache the `BeanInfo`
object. Subsequent calls to this method will be answered with the cached
data.

<br />

##### Parameters

| beanClass | the specified bean class. |
|---|---|

##### Returns

- the `BeanInfo` of the bean class.

##### Throws

| [IntrospectionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/beans/IntrospectionException.html) |   |
|---|---|

#### public static [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getBeanInfoSearchPath**
()

Gets an array of search packages.

##### Returns

- an array of search packages.

#### public static void
**setBeanInfoSearchPath**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) path)

Sets the search packages.

##### Parameters

| path | the new search packages to be set. |
|---|---|