Apache JMeter

org.apache.jmeter.testbeans
Class BeanInfoSupport

java.lang.Object
  extended by java.beans.SimpleBeanInfo
      extended by org.apache.jmeter.testbeans.BeanInfoSupport
All Implemented Interfaces:
java.beans.BeanInfo
Direct Known Subclasses:
AccessLogSamplerBeanInfo, BeanShellBeanInfoSupport, BSFBeanInfoSupport, ConstantThroughputTimerBeanInfo, CSVDataSetBeanInfo, DataSourceElementBeanInfo, DebugPostProcessorBeanInfo, DebugSamplerBeanInfo, Example2BeanInfo, JDBCSamplerBeanInfo, RandomVariableConfigBeanInfo, 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:

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.

Version:
$Revision: 674365 $

Field Summary
static java.lang.String DEFAULT
           
static java.lang.String NOT_EXPRESSION
           
static java.lang.String NOT_OTHER
           
static java.lang.String NOT_UNDEFINED
           
static java.lang.String RESOURCE_BUNDLE
           
static java.lang.String TAGS
           
 
Fields inherited from interface java.beans.BeanInfo
ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32
 
Constructor Summary
protected BeanInfoSupport(java.lang.Class beanClass)
          Construct a BeanInfo for the given class.
 
Method Summary
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  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
See Also:
Constant Field Values

NOT_EXPRESSION

public static final java.lang.String NOT_EXPRESSION
See Also:
Constant Field Values

NOT_OTHER

public static final java.lang.String NOT_OTHER
See Also:
Constant Field Values

DEFAULT

public static final java.lang.String DEFAULT
See Also:
Constant Field Values

RESOURCE_BUNDLE

public static final java.lang.String RESOURCE_BUNDLE
See Also:
Constant Field Values
Constructor Detail

BeanInfoSupport

protected BeanInfoSupport(java.lang.Class beanClass)
Construct a BeanInfo for the given class.

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

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 assing 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

Apache JMeter

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