Interface PropertyValue


public interface PropertyValue

A PropertyValue provides a mechanism whereby the currently configured value of a processor property can be obtained in different forms.

  • 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

      Long asTimePeriod(TimeUnit timeUnit)
      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

      Double asDataSize(DataUnit dataUnit)
      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, or null 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, or null 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 of this points to a ControllerService but that service is not of type serviceType or if serviceType 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

      <E extends Enum<E>> E asAllowableValue(Class<E> enumType) throws IllegalArgumentException
      Returns the property value as one of the configured allowableValues, see PropertyDescriptor.Builder.allowableValues(Class)

      The Class.getEnumConstants() of the provided enum are searched for an entry matching the value of this. In case an enum value is a DescribedValue, uses the defined DescribedValue.getValue() for comparison. Otherwise, the Enum.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 of this is found.
    • isSet

      boolean isSet()
      Returns:
      true if the user has configured a value, or if the PropertyDescriptor for the associated property has a default value, false otherwise
    • evaluateAttributeExpressions

      PropertyValue evaluateAttributeExpressions() throws ProcessException

      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

      PropertyValue evaluateAttributeExpressions(Map<String,String> attributes) throws ProcessException

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

      PropertyValue evaluateAttributeExpressions(FlowFile flowFile) throws ProcessException

      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 ProcessException

      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.
      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 ProcessException

      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.
      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,String> stateValues) throws ProcessException

      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 of
      additionalAttributes - 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 Language
      stateValues - 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 against
      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
    • 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.