JavaBean (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: java.beans, annotation type: JavaBean
Keywords: java.beans.JavaBean class

# Annotation Interface JavaBean

@Documented @Target(TYPE) @Retention(RUNTIME) public @interface JavaBean
An annotation used to specify some class-related information for the automatically generated `BeanInfo` classes. This annotation is not used if the annotated class has a corresponding user-defined `BeanInfo` class, which does not imply the automatic analysis.

Since:
  9
See Also:
  - `BeanInfo.getBeanDescriptor()`

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `String`
  `defaultEventSet`
  The name of the default event set is used to calculate its `index` in the `array` of event sets defined in the annotated class.
  `String`
  `defaultProperty`
  The name of the default property is used to calculate its `index` in the `array` of properties defined in the annotated class.
  `String`
  `description`
  The `short description` for the `bean descriptor` of the annotated class.

- ## Element Details

  - ### description

    String description
    The `short description` for the `bean descriptor` of the annotated class.
    Returns:
      the bean description, or an empty string if the description is not set.
    Default:
      `""`

  - ### defaultProperty

    String defaultProperty
    The name of the default property is used to calculate its `index` in the `array` of properties defined in the annotated class. If the name is not set or the annotated class does not define a property with the specified name, the default property index will be calculated automatically by the `Introspector` depending on its state.
    Returns:
      the name of the default property, or an empty string if the name is not set.
    Default:
      `""`

  - ### defaultEventSet

    String defaultEventSet
    The name of the default event set is used to calculate its `index` in the `array` of event sets defined in the annotated class. If the name is not set or the annotated class does not define an event set with the specified name, the default event set index will be calculated automatically by the `Introspector` depending on its state.
    Returns:
      the name of the default event set, or an empty string if the name is not set.
    Default:
      `""`