org.apache.jmeter.testbeans

## Class BeanInfoSupport

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

- All Implemented Interfaces:
    java.beans.BeanInfo
  Direct Known Subclasses:
    AccessLogSamplerBeanInfo, BeanShellBeanInfoSupport, CompareAssertionBeanInfo, ConstantThroughputTimerBeanInfo, CSVDataSetBeanInfo, DataSourceElementBeanInfo, DebugPostProcessorBeanInfo, DebugSamplerBeanInfo, Example2BeanInfo, Example3BeanInfo, JDBCTestElementBeanInfoSupport, KeystoreConfigBeanInfo, MongoScriptSamplerBeanInfo, MongoSourceElementBeanInfo, PreciseThroughputTimerBeanInfo, RandomVariableConfigBeanInfo, ScriptingBeanInfoSupport, SyncTimerBeanInfo

      public abstract class BeanInfoSupport
      extends java.beans.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 and Description
    --- | ---
    `static java.lang.String` | `DEFAULT` Default value, must be provided if `NOT_UNDEFINED` is TRUE
    `static java.lang.String` | `DEFAULT_NOT_SAVED` Default value is not saved; only non-defaults are saved
    `static java.lang.String` | `MULTILINE` If specified, create a multi-line editor
    `static java.lang.String` | `NOT_EXPRESSION` Whether the field disallows JMeter expressions; Boolean, default FALSE
    `static java.lang.String` | `NOT_OTHER` Whether the field disallows constant values different from the provided tags; Boolean, default FALSE
    `static java.lang.String` | `NOT_UNDEFINED` Whether the field must be defined (i.e. is required); Boolean, defaults to FALSE
    `static java.lang.String` | `RESOURCE_BUNDLE` Pointer to the resource bundle, if any (will generally be null)
    `static java.lang.String` | `TAGS`
    `static java.lang.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 and Description
    --- | ---
    `protected` | `BeanInfoSupport(java.lang.Class<? extends TestBean> beanClass)` Construct a BeanInfo for the given class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `createPropertyGroup(java.lang.String group, java.lang.String[] names)` Utility method to group and order properties.
    `java.beans.BeanInfo[]` | `getAdditionalBeanInfo()`
    `java.beans.BeanDescriptor` | `getBeanDescriptor()`
    `int` | `getDefaultEventIndex()`
    `int` | `getDefaultPropertyIndex()`
    `java.beans.EventSetDescriptor[]` | `getEventSetDescriptors()`
    `java.awt.Image` | `getIcon(int iconKind)`
    `java.beans.MethodDescriptor[]` | `getMethodDescriptors()`
    `java.beans.PropertyDescriptor[]` | `getPropertyDescriptors()`
    `protected java.beans.PropertyDescriptor` | `property(java.lang.String name)` Get the property descriptor for the property of the given name.
    `protected java.beans.PropertyDescriptor` | `property(java.lang.String name, java.lang.Class<? extends java.lang.Enum<?>> enumClass)` Get the property descriptor for the property of the given name.
    `protected java.beans.PropertyDescriptor` | `property(java.lang.String name, TypeEditor editor)` Get the property descriptor for the property of the given name.
    `protected void` | `setIcon(java.lang.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 Detail

    - #### TAGS

          public static final java.lang.String TAGS

      See Also:
        Constant Field Values

    - #### NOT_UNDEFINED

          public static final java.lang.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 java.lang.String NOT_EXPRESSION

      Whether the field disallows JMeter expressions; Boolean, default FALSE
      See Also:
        Constant Field Values

    - #### NOT_OTHER

          public static final java.lang.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 java.lang.String MULTILINE

      If specified, create a multi-line editor
      See Also:
        Constant Field Values

    - #### DEFAULT

          public static final java.lang.String DEFAULT

      Default value, must be provided if `NOT_UNDEFINED` is TRUE
      See Also:
        Constant Field Values

    - #### DEFAULT_NOT_SAVED

          public static final java.lang.String DEFAULT_NOT_SAVED

      Default value is not saved; only non-defaults are saved
      See Also:
        Constant Field Values

    - #### RESOURCE_BUNDLE

          public static final java.lang.String RESOURCE_BUNDLE

      Pointer to the resource bundle, if any (will generally be null)
      See Also:
        Constant Field Values

    - #### TEXT_LANGUAGE

          public static final java.lang.String TEXT_LANGUAGE

      TextEditor property
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BeanInfoSupport

          protected BeanInfoSupport(java.lang.Class<? extends TestBean> beanClass)

      Construct a BeanInfo for the given class.
      Parameters:
        `beanClass` - class for which to construct a BeanInfo

  - ### Method Detail

    - #### property

          protected java.beans.PropertyDescriptor property(java.lang.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 java.beans.PropertyDescriptor property(java.lang.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 java.beans.PropertyDescriptor property(java.lang.String name,
                                                           java.lang.Class<? extends java.lang.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(java.lang.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(java.lang.String group,
                                             java.lang.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 java.beans.BeanInfo[] getAdditionalBeanInfo()

      Specified by:
        `getAdditionalBeanInfo` in interface `java.beans.BeanInfo`
      Overrides:
        `getAdditionalBeanInfo` in class `java.beans.SimpleBeanInfo`

    - #### getBeanDescriptor

          public java.beans.BeanDescriptor getBeanDescriptor()

      Specified by:
        `getBeanDescriptor` in interface `java.beans.BeanInfo`
      Overrides:
        `getBeanDescriptor` in class `java.beans.SimpleBeanInfo`

    - #### getDefaultEventIndex

          public int getDefaultEventIndex()

      Specified by:
        `getDefaultEventIndex` in interface `java.beans.BeanInfo`
      Overrides:
        `getDefaultEventIndex` in class `java.beans.SimpleBeanInfo`

    - #### getDefaultPropertyIndex

          public int getDefaultPropertyIndex()

      Specified by:
        `getDefaultPropertyIndex` in interface `java.beans.BeanInfo`
      Overrides:
        `getDefaultPropertyIndex` in class `java.beans.SimpleBeanInfo`

    - #### getEventSetDescriptors

          public java.beans.EventSetDescriptor[] getEventSetDescriptors()

      Specified by:
        `getEventSetDescriptors` in interface `java.beans.BeanInfo`
      Overrides:
        `getEventSetDescriptors` in class `java.beans.SimpleBeanInfo`

    - #### getIcon

          public java.awt.Image getIcon(int iconKind)

      Specified by:
        `getIcon` in interface `java.beans.BeanInfo`
      Overrides:
        `getIcon` in class `java.beans.SimpleBeanInfo`

    - #### getMethodDescriptors

          public java.beans.MethodDescriptor[] getMethodDescriptors()

      Specified by:
        `getMethodDescriptors` in interface `java.beans.BeanInfo`
      Overrides:
        `getMethodDescriptors` in class `java.beans.SimpleBeanInfo`

    - #### getPropertyDescriptors

          public java.beans.PropertyDescriptor[] getPropertyDescriptors()

      Specified by:
        `getPropertyDescriptors` in interface `java.beans.BeanInfo`
      Overrides:
        `getPropertyDescriptors` in class `java.beans.SimpleBeanInfo`

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.