Interface PropertyValue
A PropertyValue provides a mechanism whereby the currently configured value of a processor property can be obtained in different forms.
-
Method Summary
Modifier and TypeMethodDescription<E extends Enum<E>>
EasAllowableValue
(Class<E> enumType) Returns the property value as one of the configured allowableValues, seePropertyDescriptor.Builder.allowableValues(Class)
<T extends ControllerService>
TasControllerService
(Class<T> serviceType) asDataSize
(DataUnit dataUnit) asDouble()
Returns the value as a DurationasFloat()
asLong()
asTimePeriod
(TimeUnit timeUnit) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(Map<String, String> attributes) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(Map<String, String> attributes, AttributeValueDecorator decorator) Replaces values in the Property Value using the NiFi Expression Language.Replaces values in the Property Value using the NiFi Expression Language.evaluateAttributeExpressions
(FlowFile flowFile) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(FlowFile flowFile, Map<String, String> additionalAttributes) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(FlowFile flowFile, Map<String, String> additionalAttributes, AttributeValueDecorator decorator) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(FlowFile flowFile, Map<String, String> additionalAttributes, AttributeValueDecorator decorator, Map<String, String> stateValues) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.evaluateAttributeExpressions
(FlowFile flowFile, AttributeValueDecorator decorator) Replaces values in the Property Value using the NiFi Expression Language.getValue()
boolean
Indicates whether the value of the property uses Expression Language.boolean
isSet()
-
Method Details
-
getValue
String getValue()- Returns:
- the raw property value as a string
-
asInteger
Integer asInteger()- Returns:
- an integer representation of the property value, or
null
if not set - Throws:
NumberFormatException
- if not able to parse
-
asLong
Long asLong()- Returns:
- a Long representation of the property value, or
null
if not set - Throws:
NumberFormatException
- if not able to parse
-
asBoolean
Boolean asBoolean()- Returns:
- a Boolean representation of the property value, or
null
if not set
-
asFloat
Float asFloat()- Returns:
- a Float representation of the property value, or
null
if not set - Throws:
NumberFormatException
- if not able to parse
-
asDouble
Double asDouble()- Returns:
- a Double representation of the property value, of
null
if not set - Throws:
NumberFormatException
- if not able to parse
-
asTimePeriod
- Parameters:
timeUnit
- specifies the TimeUnit to convert the time duration into- Returns:
- a Long value representing the value of the configured time period
in terms of the specified TimeUnit; if the property is not set, returns
null
-
asDuration
Duration asDuration()Returns the value as a Duration- Returns:
- a Duration representing the value, or
null
if the value is unset
-
asDataSize
- Parameters:
dataUnit
- specifies the DataUnit to convert the data size into- Returns:
- a Long value representing the value of the configured data size
in terms of the specified DataUnit; if hte property is not set, returns
null
-
asControllerService
ControllerService asControllerService()- Returns:
- the ControllerService whose identifier is the raw value of
this
, ornull
if either the value is not set or the value does not identify a ControllerService
-
asControllerService
<T extends ControllerService> T asControllerService(Class<T> serviceType) throws IllegalArgumentException - Type Parameters:
T
- the generic type of the controller service- Parameters:
serviceType
- the class of the Controller Service- Returns:
- the ControllerService whose identifier is the raw value of the
this
, ornull
if either the value is not set or the value does not identify a ControllerService. The object returned by this method is explicitly cast to type specified, if the type specified is valid. Otherwise, throws an IllegalArgumentException - Throws:
IllegalArgumentException
- if the value ofthis
points to a ControllerService but that service is not of typeserviceType
or ifserviceType
references a class that is not an interface
-
asResource
ResourceReference asResource()- Returns:
- a ResourceReference for the configured property value, or
null
if no value was specified, or if the property references multiple resources. - See Also:
-
asResources
ResourceReferences asResources()- Returns:
- a ResourceReferences for the configured property value. If no property value is set, a ResourceReferences will be returned that references no resources.
I.e., this method will never return
null
.
-
asAllowableValue
Returns the property value as one of the configured allowableValues, seePropertyDescriptor.Builder.allowableValues(Class)
The
Class.getEnumConstants()
of the provided enum are searched for an entry matching the value ofthis
. In case an enum value is aDescribedValue
, uses the definedDescribedValue.getValue()
for comparison. Otherwise, theEnum.name()
is used.- Type Parameters:
E
- the generic type of the enum used as allowableValues- Parameters:
enumType
- the class of the enum used as allowableValues- Returns:
- the matching enum entry, or
null
if the value is not set. - Throws:
IllegalArgumentException
- if no enum entry matching the value ofthis
is found.
-
isSet
boolean isSet()- Returns:
true
if the user has configured a value, or if thePropertyDescriptor
for the associated property has a default value,false
otherwise
-
evaluateAttributeExpressions
Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Returns:
- a PropertyValue with the new value is returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
attributes
- a Map of attributes that the Expression can reference. These will take precedence over any underlying env/syst properties values.- Returns:
- a PropertyValue with the new value
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(Map<String, String> attributes, AttributeValueDecorator decorator) throws ProcessExceptionReplaces values in the Property Value using the NiFi Expression Language. The supplied decorator is then given a chance to decorate the value, and a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
attributes
- a Map of attributes that the Expression can reference. These will take precedence over any variables in any underlying variable registry.decorator
- the decorator to use in order to update the values returned after variable substitution and expression language evaluation.- Returns:
- a PropertyValue with the new value
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
flowFile
- to evaluate attributes of. It's flow file properties and then flow file attributes will take precedence over any underlying env/syst properties.- Returns:
- a PropertyValue with the new value is returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(FlowFile flowFile, Map<String, String> additionalAttributes) throws ProcessExceptionReplaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
flowFile
- to evaluate attributes of. It's flow file properties and then flow file attributes will take precedence over any underlying env/syst properties.additionalAttributes
- a Map of additional attributes that the Expression can reference. These attributes will take precedence over any conflicting attributes in the provided flowfile or any underlying env/syst properties.- Returns:
- a PropertyValue with the new value is returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(FlowFile flowFile, Map<String, String> additionalAttributes, AttributeValueDecorator decorator) throws ProcessExceptionReplaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
flowFile
- to evaluate attributes of. It's flow file properties and then flow file attributes will take precedence over any underlying env/syst properties.additionalAttributes
- a Map of additional attributes that the Expression can reference. These attributes will take precedence over any conflicting attributes in the provided flowfile or any underlying env/syst properties.decorator
- the decorator to use in order to update the values returned after variable substitution and expression language evaluation.- Returns:
- a PropertyValue with the new value is returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(FlowFile flowFile, Map<String, String> additionalAttributes, AttributeValueDecorator decorator, Map<String, throws ProcessExceptionString> stateValues) Replaces values in the Property Value using the NiFi Expression Language; a PropertyValue with the new value is then returned, supporting call chaining.
- Parameters:
flowFile
- to evaluate attributes ofadditionalAttributes
- a Map of additional attributes that the Expression can reference. If entries in this Map conflict with entries in the FlowFile's attributes, the entries in this Map are given a higher priority.decorator
- the decorator to use in order to update the values returned by the Expression LanguagestateValues
- a Map of the state values to be referenced explicitly by specific state accessing functions- Returns:
- a PropertyValue with the new value is returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(AttributeValueDecorator decorator) throws ProcessException Replaces values in the Property Value using the NiFi Expression Language. The supplied decorator is then given a chance to decorate the value, and a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
decorator
- the decorator to use in order to update the values returned after variable substitution and expression language evaluation.- Returns:
- a PropertyValue with the new value is then returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
evaluateAttributeExpressions
PropertyValue evaluateAttributeExpressions(FlowFile flowFile, AttributeValueDecorator decorator) throws ProcessException Replaces values in the Property Value using the NiFi Expression Language. The supplied decorator is then given a chance to decorate the value, and a PropertyValue with the new value is then returned, supporting call chaining. Before executing the expression language statement any variables names found within any underlying
EnvironmentVariables
will be substituted with their values.- Parameters:
flowFile
- to evaluate expressions againstdecorator
- the decorator to use in order to update the values returned after variable substitution and expression language evaluation.- Returns:
- a PropertyValue with the new value is then returned, supporting call chaining
- Throws:
ProcessException
- if the Expression cannot be compiled or evaluating the Expression against the given attributes causes an Exception to be thrown
-
isExpressionLanguagePresent
boolean isExpressionLanguagePresent()Indicates whether the value of the property uses Expression Language.
- Returns:
true
if the property value makes use of the Expression Language,false
otherwise.
-