Annotation Type CustomMetric
-
@Target(value=METHOD) @Retention(value=RUNTIME) @Documented public @interface CustomMetric
Declare a relationship between anOperator
's Java bean property and custom metric. This allowsOperator
implementations to simplify theirinitialize
method by having the SPL runtime automatically set field values using setter methods.Any Java bean setter methods of an
Operator
implementation class or its super classes annotated@CustomMetric
are invoked by the SPL runtime passing the custom metric'sMetric
reference. The custom metric's name defaults to the Java bean property's name, but may be set explicitly usingname()
.Setter methods are invoked before
Operator.initialize
is invoked. Invocation ordering of setter methods is not defined.Java bean properties of the operator's class and its super-classes are identified using
java.beans.BeanInfo.getPropertyDescriptors()
with theBeanInfo
instance obtained usingjava.beans.Inspector
. The setter method is identified by thegetWriteMethod
of a class'sBeanInfo
.If the SPL runtime throws an exception during automatic setting of metrics prior to initialization the processing element will terminate.
AnIllegalStateException
is thrown if the Java Bean property's type is notMetric
.
AnIllegalStateException
is thrown if the corresponding custom metric definition in the Java primitive's operator model has a differentkind
.
No action is taken for non-setter methods annotated @CustomMetric.The method this annotation is applied to must be:
public
- an instance method (not
static
) - return type of
void
- have a single parameter of type
Metric
.
- Since:
- InfoSphere® Streams Version 3.1
- See Also:
OperatorMetrics
,Metric
-
-
Required Element Summary
Required Elements Modifier and Type Required Element and Description Metric.Kind
kind
Kind of the custom metric.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and Description java.lang.String
description
Description of the custom metricboolean
mxbean
Register the custom metric as aMetricMXBean
in the platform MBean server.java.lang.String
name
Name of the custom metric
-
-
-
Element Detail
-
kind
public abstract Metric.Kind kind
Kind of the custom metric.
-
name
public abstract java.lang.String name
Name of the custom metric- Returns:
- The name of the custom metric or the empty string to indicate the custom metric name matches the Java bean property name.
- Default:
- ""
-
description
public abstract java.lang.String description
Description of the custom metric- Returns:
- The description of the custom metric.
- Default:
- ""
-
mxbean
public abstract boolean mxbean
Register the custom metric as aMetricMXBean
in the platform MBean server.- Returns:
- True to register the custom metric at operator startup, false to not register.
- See Also:
OperatorContextMXBean.registerCustomMetric(String)
- Default:
- false
-
-