Class SBPropertyDescriptor
- Direct Known Subclasses:
ConfigurationChooserPropertyDescriptor,EnumPropertyDescriptor,HOCONConfigurationChooserPropertyDescriptor,JavaEnumPropertyDescriptor,JavaTypePropertyDescriptor,ResourceFilePropertyDescriptor,SBExpressionPropertyDescriptor
This class should be used for primitive java properties (int, long, etc.),
Timestamp, Schema, String[], String[][] and Map\invalid input: '<'String, String\>. Subclasses
handle specialized property types that support advanced user interface displays:
-
JavaEnumPropertyDescriptordisplays a drop-down to allow the user to select one value from a javaEnum -
EnumPropertyDescriptordisplays a drop-down to allow the user to select one string value out of a set -
ResourceFilePropertyDescriptordisplays a drop-down to allow the user to select a valid resource file that is accessible to operators usingOperator.getResourceContents(String) -
SBExpressionPropertyDescriptoris 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. -
ConfigurationChooserPropertyDescriptordisplays a drop-down to allow the user to select some element contained within the server's configuration file.
Since 6.1.3, control over the StreamBase Studio user interface for properties can be achieved by
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
Since 11.2.0, operators can specify migrations for deprecated properties, See migrateTo(SBPropertyDescriptor, Class, Class, Function)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intis this property really a StreamBase expression?static final intconstant to signify that this property is not a StreamBase expression. -
Constructor Summary
ConstructorsConstructorDescriptionSBPropertyDescriptor(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
Modifier and TypeMethodDescriptionMark the descriptor as deprecated.Calls setShortDescription method, but can be chained as in:new SBPropertyDescriptor("value", Bean.class).description("useful value to set")Calls setDisplayName method, but can be chained as in:new SBPropertyDescriptor("value", Bean.class).displayName("Important Value")intReturn the input port that this property is bound to.booleanDeprecated.intDeprecated.usegetUIHints()insteadRetrieves the currently associatedUIHintsobject for this propertybooleanReturn whether the property is deprecated.booleanIs this property an expression?booleanReturn whether the property is required.mask()Deprecated.usesetUIHints(UIHints)instead<S,T> SBPropertyDescriptor migrateTo(SBPropertyDescriptor targetProperty, Class<S> sourceType, Class<T> targetType, Function<S, T> valueConverter) migrate current property to another propertymultiline(int size) Deprecated.usesetUIHints(UIHints)insteadoptional()Mark the descriptor as optional.voidsetDeprecated(boolean deprecated) Set whether the property is deprecated.voidsetMaskStringDisplay(boolean mask) Deprecated.usesetUIHints(UIHints)insteadvoidsetMultiLine(int size) Deprecated.usesetUIHints(UIHints)insteadvoidsetRequired(boolean required) Set whether the property is required.setUIHints(UIHints hints) Associate aUIHintsobject 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, setWriteMethodMethods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString
-
Field Details
-
NOT_AN_EXPRESSION
public static final int NOT_AN_EXPRESSIONconstant 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:
-
expressionInputPort
protected int expressionInputPortis this property really a StreamBase expression?
-
-
Constructor Details
-
SBPropertyDescriptor
Construct a property descriptor.- Parameters:
propertyName- the name of the propertybeanClass- 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 propertybeanClass- the operator class containing the propertyreadMethodName- the name of the method used to read the propertywriteMethodName- 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 frombeanClass- the operator class containing the property- Throws:
IntrospectionException- if introspection fails
-
-
Method Details
-
optional
-
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
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
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
Deprecated.usesetUIHints(UIHints)insteadCalls setMaskStringDisplay(true)- Returns:
- this, so the call can be chained
- See Also:
-
multiline
Deprecated.usesetUIHints(UIHints)insteadCalls setMultiLine(size) to create a multiline edit box- Parameters:
size- of the edit box- Returns:
- this, so the call can be chained
- See Also:
-
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
-
getUIHints
-
setMaskStringDisplay
Deprecated.usesetUIHints(UIHints)insteadFor backwards compatibility, this call will set aUIHints(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:
-
getMaskDisplay
Deprecated.usegetUIHints()insteadFor backwards compatibility, this call will defer to the associatedUIHints(if any).- Returns:
- whether to mask the characters of this property, if it is a String
-
setMultiLine
Deprecated.usesetUIHints(UIHints)insteadFor backwards compatibility, this call will set aUIHints(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:
-
getMultiLine
Deprecated.usegetUIHints()insteadFor backwards compatibility, this call will defer to the associatedUIHints(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.
-
migrateTo
public <S,T> SBPropertyDescriptor migrateTo(SBPropertyDescriptor targetProperty, Class<S> sourceType, Class<T> targetType, Function<S, T> valueConverter) throws IntrospectionExceptionmigrate current property to another property- Parameters:
targetProperty- target propertysourceType- source property typetargetType- target property typevalueConverter- value converter function- Returns:
- this, so the call can be chained
- Throws:
IntrospectionException- error on migration- Since:
- 11.2.0
-
getUIHints()instead