com.streambase.sb.operator.parameter

## Class SBPropertyDescriptor

- java.lang.Object
- - java.beans.FeatureDescriptor
  - - java.beans.PropertyDescriptor
    - - com.streambase.sb.operator.parameter.SBPropertyDescriptor

- Direct Known Subclasses:
    ConfigurationChooserPropertyDescriptor, EnumPropertyDescriptor, JavaTypePropertyDescriptor, ResourceFilePropertyDescriptor, SBExpressionPropertyDescriptor

      public class SBPropertyDescriptor
      extends PropertyDescriptor

  PropertyDescriptor subclass used by StreamBase operators and adapters to describe a property. The properties are used by Studio to display a user interface to the user, and is used to serialize/deserialize the operator to xml in EventFlow application files.

  This class should be used for primitive java properties (int, long, etc.), `Timestamp`, `Schema`, String[], and String[][]. Subclasses handle specialized property types that support advanced user interface displays:

  - `JavaEnumPropertyDescriptor` displays a drop-down to allow the user to select one value from a java `Enum`
  - `EnumPropertyDescriptor` displays a drop-down to allow the user to select one string value out of a set
  - `ResourceFilePropertyDescriptor` displays a drop-down to allow the user to select a valid resource file that is accessible to operators using `Operator.getResourceContents(String)`
  - `SBExpressionPropertyDescriptor` is used to support the use of the StreamBase expression language to evaluate the property value at runtime. The user will be presented with a text field to enter the expression text in Studio.
  - `ConfigurationChooserPropertyDescriptor` displays a drop-down to allow the user to select some element contained within the server's configuration file.
  Property names must be unique for each operator. In other words, each property name for a specific operator must not have the same name as any other property for that operator.

  Since 6.1.3, control over the StreamBase Studio user interface for properties can be achieved by `SBPropertyDescriptor.setUIHints(UIHints)`. See also `Parameterizable` for how to achieve widget enablement control.

  Since 7.3.5, properties of type String[][] are supported. These properties allow a list of paired values (that is, the length of the array for each entry must be exactly two).

  Since 7.5, an operator can access the server configuration file, and use of a `ConfigurationChooserPropertyDescriptor` allows user input in retrieving information contained therein

  See Also:
    `JavaEnumPropertyDescriptor`, `EnumPropertyDescriptor`, `ResourceFilePropertyDescriptor`, `SBExpressionPropertyDescriptor`, `ConfigurationChooserPropertyDescriptor`, `Parameterizable`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `SBPropertyDescriptor.SingleValueSetter` This abstract specialization of Setter assumes that the property type will have a single value (which currently accounts for all property types except string lists).

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `_expressionInputPort` is this property really a StreamBase expression?
    `static int` | `NOT_AN_EXPRESSION` contstant to signify that this property is not a StreamBase expression.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SBPropertyDescriptor(PropertyDescriptor pd, Class<?> beanClass)` Copy a property descriptor.
    `SBPropertyDescriptor(String propertyName, Class<?> beanClass)` Construct a property descriptor.
    `SBPropertyDescriptor(String propertyName, Class<?> beanClass, String readMethodName, String writeMethodName)` Construct a property descriptor with non-standard read/write method names.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `SBPropertyDescriptor` | `deprecated()` Mark the descriptor as deprecated.
    `SBPropertyDescriptor` | `description(String s)` Calls setShortDescription method, but can be chained as in: `new SBPropertyDescriptor("value", Bean.class).description("useful value to set")`
    `SBPropertyDescriptor` | `displayName(String s)` Calls setDisplayName method, but can be chained as in: `new SBPropertyDescriptor("value", Bean.class).displayName("Important Value")`
    `int` | `getExpressionInputPort()` Return the input port that this property is bound to.
    `boolean` | `getMaskDisplay()` Deprecated. use `SBPropertyDescriptor.getUIHints()` instead
    `int` | `getMultiLine()` Deprecated. use `SBPropertyDescriptor.getUIHints()` instead
    `UIHints` | `getUIHints()` Retrieves the currently associated `UIHints` object for this property
    `boolean` | `isDeprecated()` Return whether the property is deprecated.
    `boolean` | `isExpression()` Is this property an expression?
    `boolean` | `isRequired()` Return whether the property is required.
    `SBPropertyDescriptor` | `mask()` Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
    `SBPropertyDescriptor` | `multiline(int size)` Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
    `SBPropertyDescriptor` | `optional()` Mark the descriptor as optional.
    `void` | `setDeprecated(boolean deprecated)` Set whether the property is deprecated.
    `void` | `setMaskStringDisplay(boolean mask)` Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
    `void` | `setMultiLine(int size)` Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
    `void` | `setRequired(boolean required)` Set whether the property is required.
    `SBPropertyDescriptor` | `setUIHints(UIHints hints)` Associate a `UIHints` object with this property, providing StreamBase Studio with additional layout and display information for this property.

    - ### Methods inherited from class java.beans.PropertyDescriptor

      `createPropertyEditor, equals, getPropertyEditorClass, getPropertyType, getReadMethod, getWriteMethod, hashCode, isBound, isConstrained, setBound, setConstrained, setPropertyEditorClass, setReadMethod, setWriteMethod`

    - ### Methods inherited from class java.beans.FeatureDescriptor

      `attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### NOT_AN_EXPRESSION

          public static final int NOT_AN_EXPRESSION

      contstant to signify that this property is not a StreamBase expression. We signify that a property is a StreamBaseExpression by assigning the property to an input port.
      See Also:
        Constant Field Values

    - #### _expressionInputPort

          protected int _expressionInputPort

      is this property really a StreamBase expression?

  - ### Constructor Detail

    - #### SBPropertyDescriptor

          public SBPropertyDescriptor(String propertyName,
                                      Class<?> beanClass)
                               throws IntrospectionException

      Construct a property descriptor.
      Parameters:
        `propertyName` - the name of the property
        `beanClass` - the operator class containing the property
      Throws:
        `IntrospectionException` - if introspection fails

    - #### SBPropertyDescriptor

          public SBPropertyDescriptor(String propertyName,
                                      Class<?> beanClass,
                                      String readMethodName,
                                      String writeMethodName)
                               throws IntrospectionException

      Construct a property descriptor with non-standard read/write method names.
      Parameters:
        `propertyName` - the name of the property
        `beanClass` - the operator class containing the property
        `readMethodName` - the name of the method used to read the property
        `writeMethodName` - the name of the method used to write the property
      Throws:
        `IntrospectionException` - if introspection fails

    - #### SBPropertyDescriptor

          public SBPropertyDescriptor(PropertyDescriptor pd,
                                      Class<?> beanClass)
                               throws IntrospectionException

      Copy a property descriptor.
      Parameters:
        `pd` - a property descriptor to copy from
        `beanClass` - the operator class containing the property
      Throws:
        `IntrospectionException` - if introspection fails

  - ### Method Detail

    - #### optional

          public SBPropertyDescriptor optional()

      Mark the descriptor as optional.
      Returns:
        this object

    - #### deprecated

          public SBPropertyDescriptor deprecated()

      Mark the descriptor as deprecated. Deprecated properties do not appear in an operator's property view within Studio and are discarded from StreamBase application files.
      Returns:
        this object
      Since:
        6.3.5

    - #### isExpression

          public boolean isExpression()

      Is this property an expression?
      Returns:
        is this property an expression?

    - #### getExpressionInputPort

          public int getExpressionInputPort()

      Return the input port that this property is bound to. May return NOT_AN_EXPRESSION as not all properties are expressions.
      Returns:
        input port that this expression is bound to

    - #### displayName

          public SBPropertyDescriptor displayName(String s)

      Calls setDisplayName method, but can be chained as in: `new SBPropertyDescriptor("value", Bean.class).displayName("Important Value")`
      Parameters:
        `s` - The display name
      Returns:
        this, so the call can be chained

    - #### description

          public SBPropertyDescriptor description(String s)

      Calls setShortDescription method, but can be chained as in: `new SBPropertyDescriptor("value", Bean.class).description("useful value to set")`
      Parameters:
        `s` - The display name
      Returns:
        this, so the call can be chained

    - #### mask

          public SBPropertyDescriptor mask()

      Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
      Calls setMaskStringDisplay(true)
      Returns:
        this, so the call can be chained
      See Also:
        `UIHints`

    - #### multiline

          public SBPropertyDescriptor multiline(int size)

      Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
      Calls setMultiLine(size) to create a multiline edit box
      Parameters:
        `size` - of the edit box
      Returns:
        this, so the call can be chained
      See Also:
        `UIHints`

    - #### isDeprecated

          public boolean isDeprecated()

      Return whether the property is deprecated. Deprecated properties do not appear in an operator's property view within Studio and are discarded from StreamBase application files.
      Returns:
        true if the property is deprecated
      Since:
        6.3.5

    - #### setDeprecated

          public void setDeprecated(boolean deprecated)

      Set whether the property is deprecated. Deprecated properties do not appear in an operator's property view within Studio and are discarded from StreamBase application files.
      Parameters:
        `deprecated` - true if the property is deprecated, or false if not
      Since:
        6.3.5

    - #### isRequired

          public boolean isRequired()

      Return whether the property is required.
      Returns:
        true if the property is required

    - #### setRequired

          public void setRequired(boolean required)

      Set whether the property is required.
      Parameters:
        `required` - true if the property is required, or false if not

    - #### setUIHints

          public SBPropertyDescriptor setUIHints(UIHints hints)

      Associate a `UIHints` object with this property, providing StreamBase Studio with additional layout and display information for this property.
      Parameters:
        `hints` - a new `UIHints` object to associate with this property. Must not be null.
      Returns:
        a descriptor for this property
      Since:
        6.1.2

    - #### getUIHints

          public UIHints getUIHints()

      Retrieves the currently associated `UIHints` object for this property
      Returns:
        a non-null `UIHints`
      Since:
        6.1.2

    - #### setMaskStringDisplay

          public void setMaskStringDisplay(boolean mask)

      Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
      For backwards compatibility, this call will set a `UIHints` (creating one if necessary) for this property with the mask property as given.
      Parameters:
        `mask` - whether to request character masking for displays of this property
      See Also:
        `UIHints`

    - #### getMaskDisplay

          public boolean getMaskDisplay()

      Deprecated. use `SBPropertyDescriptor.getUIHints()` instead
      For backwards compatibility, this call will defer to the associated `UIHints` (if any).
      Returns:
        whether to mask the characters of this property, if it is a String

    - #### setMultiLine

          public void setMultiLine(int size)

      Deprecated. use `SBPropertyDescriptor.setUIHints(UIHints)` instead
      For backwards compatibility, this call will set a `UIHints` (creating one if necessary) for this property with the multi line property as given.
      Parameters:
        `size` - representing the requested size (in lines) of this property's edit box
      See Also:
        `UIHints`

    - #### getMultiLine

          public int getMultiLine()

      Deprecated. use `SBPropertyDescriptor.getUIHints()` instead
      For backwards compatibility, this call will defer to the associated `UIHints` (if any). Note that in versions prior to 6.1.2, this returned 0 to indicate one line. This method now returns 1 in this case.
      Returns:
        an integer representing the number of requested lines. 0 means not set and implies one line.

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.