Package org.apache.jmeter.testbeans

# Class BeanInfoSupport

java.lang.Object
java.beans.SimpleBeanInfo
org.apache.jmeter.testbeans.BeanInfoSupport

All Implemented Interfaces:
  `BeanInfo`

Direct Known Subclasses:
  `AccessLogSamplerBeanInfo`, `BeanShellBeanInfoSupport`, `BoltConnectionElementBeanInfo`, `BoltTestElementBeanInfoSupport`, `CompareAssertionBeanInfo`, `ConstantThroughputTimerBeanInfo`, `CSVDataSetBeanInfo`, `DataSourceElementBeanInfo`, `DebugPostProcessorBeanInfo`, `DebugSamplerBeanInfo`, `JDBCTestElementBeanInfoSupport`, `KeystoreConfigBeanInfo`, `MongoScriptSamplerBeanInfo`, `MongoSourceElementBeanInfo`, `PreciseThroughputTimerBeanInfo`, `RandomVariableConfigBeanInfo`, `ScriptingBeanInfoSupport`, `SyncTimerBeanInfo`

public abstract class BeanInfoSupport extends SimpleBeanInfo
Support class for test bean beanInfo objects. It will help using the introspector to get most of the information, to then modify it at will.

To use, subclass it, create a subclass with a parameter-less constructor that:

1. Calls super(beanClass)
2. Modifies the property descriptors, bean descriptor, etc. at will.

Even before any such modifications, a resource bundle named xxxResources (where xxx is the fully qualified bean class name) will be obtained if available and used to localize the following:

- Bean's display name -- from property displayName.
- Properties' display names -- from properties propertyName.displayName.
- Properties' short descriptions -- from properties propertyName.shortDescription.

The resource bundle will be stored as the bean descriptor's "resourceBundle" attribute, so that it can be used for further localization. TestBeanGUI, for example, uses it to obtain the group's display names from properties groupName.displayName.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT`
  Default value, must be provided if `NOT_UNDEFINED` is TRUE
  `static final String`
  `DEFAULT_NOT_SAVED`
  Default value is not saved; only non-defaults are saved
  `static final String`
  `MULTILINE`
  If specified, create a multi-line editor
  `static final String`
  `NOT_EXPRESSION`
  Whether the field disallows JMeter expressions; Boolean, default FALSE
  `static final String`
  `NOT_OTHER`
  Whether the field disallows constant values different from the provided tags; Boolean, default FALSE
  `static final String`
  `NOT_UNDEFINED`
  Whether the field must be defined (i.e.
  `static final String`
  `RESOURCE_BUNDLE`
  Pointer to the resource bundle, if any (will generally be null)
  `static final String`
  `TAGS`
  `static final String`
  `TEXT_LANGUAGE`
  TextEditor property

  ### Fields inherited from interface java.beans.BeanInfo

  `ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `BeanInfoSupport(Class<? extends TestBean> beanClass)`
  Construct a BeanInfo for the given class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `createPropertyGroup(String group, String[] names)`
  Utility method to group and order properties.
  `BeanInfo[]`
  `getAdditionalBeanInfo()`
  `BeanDescriptor`
  `getBeanDescriptor()`
  `int`
  `getDefaultEventIndex()`
  `int`
  `getDefaultPropertyIndex()`
  `EventSetDescriptor[]`
  `getEventSetDescriptors()`
  `Image`
  `getIcon(int iconKind)`
  `MethodDescriptor[]`
  `getMethodDescriptors()`
  `PropertyDescriptor[]`
  `getPropertyDescriptors()`
  `protected PropertyDescriptor`
  `property(String name)`
  Get the property descriptor for the property of the given name.
  `protected PropertyDescriptor`
  `property(String name, Class<? extends Enum<?>> enumClass)`
  Get the property descriptor for the property of the given name.
  `protected PropertyDescriptor`
  `property(String name, TypeEditor editor)`
  Get the property descriptor for the property of the given name.
  `protected void`
  `setIcon(String resourceName)`
  Set the bean's 16x16 colour icon.

  ### Methods inherited from class java.beans.SimpleBeanInfo

  `loadImage`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TAGS

    public static final String TAGS
    See Also:
      - Constant Field Values

  - ### NOT_UNDEFINED

    public static final String NOT_UNDEFINED
    Whether the field must be defined (i.e. is required); Boolean, defaults to FALSE
    See Also:
      - Constant Field Values

  - ### NOT_EXPRESSION

    public static final String NOT_EXPRESSION
    Whether the field disallows JMeter expressions; Boolean, default FALSE
    See Also:
      - Constant Field Values

  - ### NOT_OTHER

    public static final String NOT_OTHER
    Whether the field disallows constant values different from the provided tags; Boolean, default FALSE
    See Also:
      - Constant Field Values

  - ### MULTILINE

    public static final String MULTILINE
    If specified, create a multi-line editor
    See Also:
      - Constant Field Values

  - ### DEFAULT

    public static final String DEFAULT
    Default value, must be provided if `NOT_UNDEFINED` is TRUE
    See Also:
      - Constant Field Values

  - ### DEFAULT_NOT_SAVED

    public static final String DEFAULT_NOT_SAVED
    Default value is not saved; only non-defaults are saved
    See Also:
      - Constant Field Values

  - ### RESOURCE_BUNDLE

    public static final String RESOURCE_BUNDLE
    Pointer to the resource bundle, if any (will generally be null)
    See Also:
      - Constant Field Values

  - ### TEXT_LANGUAGE

    public static final String TEXT_LANGUAGE
    TextEditor property
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### BeanInfoSupport

    protected BeanInfoSupport(Class<? extends TestBean> beanClass)
    Construct a BeanInfo for the given class.
    Parameters:
      `beanClass` - class for which to construct a BeanInfo

- ## Method Details

  - ### property

    protected PropertyDescriptor property(String name)
    Get the property descriptor for the property of the given name.
    Parameters:
      `name` - property name
    Returns:
      descriptor for a property of that name, or null if there's none

  - ### property

    protected PropertyDescriptor property(String name, TypeEditor editor)
    Get the property descriptor for the property of the given name. Sets the GUITYPE to the provided editor.
    Parameters:
      `name` - property name
      `editor` - the TypeEditor enum that describes the property editor
    Returns:
      descriptor for a property of that name, or null if there's none

  - ### property

    protected PropertyDescriptor property(String name, Class<? extends Enum<?>> enumClass)
    Get the property descriptor for the property of the given name. Sets the GUITYPE to the provided enum.
    Parameters:
      `name` - property name
      `enumClass` - the enum class that is to be used by the editor
    Returns:
      descriptor for a property of that name, or null if there's none

  - ### setIcon

    protected void setIcon(String resourceName)
    Set the bean's 16x16 colour icon.
    Parameters:
      `resourceName` - A pathname relative to the directory holding the class file of the current class.

  - ### createPropertyGroup

    protected void createPropertyGroup(String group, String[] names)
    Utility method to group and order properties.

    It will assign the given group name to each of the named properties, and set their order attribute so that they are shown in the given order.

    The created groups will get order 1, 2, 3,... in the order in which they are created.

    Parameters:
      `group` - name of the group
      `names` - property names in the desired order

  - ### getAdditionalBeanInfo

    public BeanInfo[] getAdditionalBeanInfo()
    Specified by:
      `getAdditionalBeanInfo` in interface `BeanInfo`
    Overrides:
      `getAdditionalBeanInfo` in class `SimpleBeanInfo`

  - ### getBeanDescriptor

    public BeanDescriptor getBeanDescriptor()
    Specified by:
      `getBeanDescriptor` in interface `BeanInfo`
    Overrides:
      `getBeanDescriptor` in class `SimpleBeanInfo`

  - ### getDefaultEventIndex

    public int getDefaultEventIndex()
    Specified by:
      `getDefaultEventIndex` in interface `BeanInfo`
    Overrides:
      `getDefaultEventIndex` in class `SimpleBeanInfo`

  - ### getDefaultPropertyIndex

    public int getDefaultPropertyIndex()
    Specified by:
      `getDefaultPropertyIndex` in interface `BeanInfo`
    Overrides:
      `getDefaultPropertyIndex` in class `SimpleBeanInfo`

  - ### getEventSetDescriptors

    public EventSetDescriptor[] getEventSetDescriptors()
    Specified by:
      `getEventSetDescriptors` in interface `BeanInfo`
    Overrides:
      `getEventSetDescriptors` in class `SimpleBeanInfo`

  - ### getIcon

    public Image getIcon(int iconKind)
    Specified by:
      `getIcon` in interface `BeanInfo`
    Overrides:
      `getIcon` in class `SimpleBeanInfo`

  - ### getMethodDescriptors

    public MethodDescriptor[] getMethodDescriptors()
    Specified by:
      `getMethodDescriptors` in interface `BeanInfo`
    Overrides:
      `getMethodDescriptors` in class `SimpleBeanInfo`

  - ### getPropertyDescriptors

    public PropertyDescriptor[] getPropertyDescriptors()
    Specified by:
      `getPropertyDescriptors` in interface `BeanInfo`
    Overrides:
      `getPropertyDescriptors` in class `SimpleBeanInfo`