51Degrees Pipeline Java  4.1

51Degrees Pipeline for Java

fiftyone.pipeline.core.data.FlowData Interface Reference

Detailed Description

A closeable structure to contain the inputs and outputs of Pipeline processing.

The Pipeline that creates FlowData must not be disposed of until the FlowData instance is finished with. Calling a FlowData method which then calls its creator will throw a runtime error.

Inheritance diagram for fiftyone.pipeline.core.data.FlowData:

[legend]

Public Member Functions

void  process ()
Process this FlowData via the owning Pipeline. More...
boolean  isStopped ()
If this flag is set to true, future FlowElements will not process this FlowData. More...
void  stop ()
Set the stop flag. More...
Pipeline  getPipeline ()
Get the Pipeline which created this FlowData instance. More...
Collection< FlowError >  getErrors ()
Obtain the collection of errors which occurred so far. More...
void  addError (FlowError error)
Add an error which has occurred during processing. More...
void  addError (Throwable e, FlowElement element)
Add an error which has occurred during processing. More...
Evidence  getEvidence ()
Get an Evidence collection. More...
< T > TryGetResult< T >  tryGetEvidence (String key, Class< T > type)
Try to get the data value from evidence. More...
List< String >  getDataKeys ()
Get a list of keys for elements of the Pipeline that have created data. More...
FlowData  addEvidence (String key, Object value)
Add a single item of evidence. More...
FlowData  addEvidence (Map< String, ?> values)
Add a map of evidence items. More...
< T extends ElementData > T  get (TypedKey< T > key)
Get the ElementData for the requested aspect. More...
ElementData  get (String key)
Get the ElementData for the requested data key. More...
< T extends ElementData > T  get (Class< T > type)
Get the ElementData for the requested ElementData implementation. More...
< T extends ElementData > T  getFromElement (FlowElement< T, ?> element)
Get the ElementData for the requested FlowElement. More...
< T > T  getAs (String key, Class< T > type)
Get the specified property as the specified type. More...
< T extends ElementData > TryGetResult< T >  tryGetValue (TypedKey< T > key)
Check if the flow data contains an item with the specified key name and type. More...
String  getAsString (String propertyName)
Get the specified property as a string. More...
Boolean  getAsBool (String propertyName)
Get the specified property as a boolean. More...
Integer  getAsInt (String propertyName)
Get the specified property as an integer. More...
Long  getAsLong (String propertyName)
Get the specified property as a long. More...
Float  getAsFloat (String propertyName)
Get the specified property as a float. More...
Double  getAsDouble (String propertyName)
Get the specified property as a double. More...
< T extends ElementData > T  getOrAdd (String elementDataKey, FlowElement.DataFactory< T > dataFactory)
Get or add the specified element data to the internal map. More...
< T extends ElementData > T  getOrAdd (TypedKey< T > key, FlowElement.DataFactory< T > dataFactory)
Get or add the specified element data to the internal map. More...
Map< String, Object >  elementDataAsMap ()
Get the ElementData for this instance as a Map. More...
Iterable< ElementData >  elementDataAsIterable ()
Get the ElementData for this instance as an Iterable. More...
Map< String, String >  getWhere (PropertyMatcher matcher)
Get all element data values that match the specified predicate. More...
DataKey  generateKey (EvidenceKeyFilter filter)
Generate a DataKey that contains the evidence data from this instance that matches the specified filter. More...
EvidenceKeyFilter  getEvidenceKeyFilter ()
Get a filter that will only include the evidence keys that can be used by the elements within the pipeline that created this flow element. More...

Member Function Documentation

◆ addError() [1/2]

void fiftyone.pipeline.core.data.FlowData.addError ( FlowError   error )

Add an error which has occurred during processing.

Parameters
error - which was thrown

◆ addError() [2/2]

void fiftyone.pipeline.core.data.FlowData.addError ( Throwable   e,
FlowElement   element  
)

Add an error which has occurred during processing.

Parameters
e - error which was thrown
element - the FlowElement which threw the error

◆ addEvidence() [1/2]

FlowData fiftyone.pipeline.core.data.FlowData.addEvidence ( String   key,
Object   value  
)

Add a single item of evidence.

Parameters
key - name identifying piece of evidence
value - the piece of evidence
Returns
this FlowData instance

◆ addEvidence() [2/2]

FlowData fiftyone.pipeline.core.data.FlowData.addEvidence ( Map< String, ?>   values )

Add a map of evidence items.

Parameters
values - to add
Returns
this FlowData instance

◆ elementDataAsMap()

Map<String, Object> fiftyone.pipeline.core.data.FlowData.elementDataAsMap ( )

Get the ElementData for this instance as a Map.

Returns
a Map containing the ElementData

◆ generateKey()

DataKey fiftyone.pipeline.core.data.FlowData.generateKey ( EvidenceKeyFilter   filter )

Generate a DataKey that contains the evidence data from this instance that matches the specified filter.

Parameters
filter - an EvidenceKeyFilter instance that defines the values to include in the generated key
Returns
a new DataKey instance

◆ get() [1/3]

<T extends ElementData> T fiftyone.pipeline.core.data.FlowData.get ( TypedKey< T >   key )

Get the ElementData for the requested aspect.

Parameters
key - the aspect to get
<T> - type type of the aspect
Returns
aspect's ElementData or null if not present

◆ get() [2/3]

ElementData fiftyone.pipeline.core.data.FlowData.get ( String   key )

Get the ElementData for the requested data key.

Parameters
key - to the aspect to get
Returns
aspect's ElementData or null if not present

◆ get() [3/3]

<T extends ElementData> T fiftyone.pipeline.core.data.FlowData.get ( Class< T >   type )

Get the ElementData for the requested ElementData implementation.

If multiple instances of the type exist then an exception is thrown.

Parameters
type - the type of ElementData to return
<T> - the type of ElementData to return
Returns
aspect's ElementData or null if the type is not present

◆ getAs()

<T> T fiftyone.pipeline.core.data.FlowData.getAs ( String   key,
Class< T >   type  
)

Get the specified property as the specified type.

Parameters
<T> - the type to return the property value as
key - the name of the property to get
Returns
the property value

◆ getAsBool()

Boolean fiftyone.pipeline.core.data.FlowData.getAsBool ( String   propertyName )

Get the specified property as a boolean.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsDouble()

Double fiftyone.pipeline.core.data.FlowData.getAsDouble ( String   propertyName )

Get the specified property as a double.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsFloat()

Float fiftyone.pipeline.core.data.FlowData.getAsFloat ( String   propertyName )

Get the specified property as a float.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsInt()

Integer fiftyone.pipeline.core.data.FlowData.getAsInt ( String   propertyName )

Get the specified property as an integer.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsLong()

Long fiftyone.pipeline.core.data.FlowData.getAsLong ( String   propertyName )

Get the specified property as a long.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsString()

String fiftyone.pipeline.core.data.FlowData.getAsString ( String   propertyName )

Get the specified property as a string.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getDataKeys()

List<String> fiftyone.pipeline.core.data.FlowData.getDataKeys ( )
Long fiftyone.pipeline.core.data.FlowData.getAsLong ( String   propertyName )

Get the specified property as a long.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getAsString()

String fiftyone.pipeline.core.data.FlowData.getAsString ( String   propertyName )

Get the specified property as a string.

Parameters
propertyName - the name of the property to get
Returns
the property value

◆ getDataKeys()

List<String> fiftyone.pipeline.core.data.FlowData.getDataKeys ( )

Get a list of keys for elements of the Pipeline that have created data.

(so far).

Returns
keys added to data

◆ getErrors()

Collection<FlowError> fiftyone.pipeline.core.data.FlowData.getErrors ( )

Obtain the collection of errors which occurred so far.

This cannot be added to externally.

Returns
a collection of FlowErrors

◆ getEvidenceKeyFilter()

EvidenceKeyFilter fiftyone.pipeline.core.data.FlowData.getEvidenceKeyFilter ( )

Get a filter that will only include the evidence keys that can be used by the elements within the pipeline that created this flow element.

Returns
EvidenceKeyFilter for this instance

◆ getFromElement()

<T extends ElementData> T fiftyone.pipeline.core.data.FlowData.getFromElement ( FlowElement< T, ?>   element )

Get the ElementData for the requested FlowElement.

This method uses the data type returned by the Element, and the key which belongs to the Element.

Parameters
element - FlowElement to get the data for
<T> - ElementData stored by the element
Returns
element data stored by the element

◆ getOrAdd() [1/2]

<T extends ElementData> T fiftyone.pipeline.core.data.FlowData.getOrAdd ( String   elementDataKey,
FlowElement.DataFactory< T >   dataFactory  
)

Get or add the specified element data to the internal map.

Parameters
<T> - the type of the data being stored
elementDataKey - the name of the element to store the data under
dataFactory - the FlowElement.DataFactory to use to create a new data to store if one does not already exist
Returns
existing data matching the key, or newly added data

◆ getOrAdd() [2/2]

<T extends ElementData> T fiftyone.pipeline.core.data.FlowData.getOrAdd ( TypedKey< T >   key,
FlowElement.DataFactory< T >   dataFactory  
)

Get or add the specified element data to the internal map.

Parameters
<T> - the type of the data being stored
key - the typed key of the element to store the data under
dataFactory - the FlowElement.DataFactory to use to create a new data to store if one does not already exist
Returns
existing data matching the key, or newly added data

◆ getWhere()

Map<String, String> fiftyone.pipeline.core.data.FlowData.getWhere ( PropertyMatcher   matcher )

Get all element data values that match the specified predicate.

Parameters
matcher - if a property passed to this matcher returns true then it will be included in the results
Returns
all the element data values that match the matcher

◆ isStopped()

boolean fiftyone.pipeline.core.data.FlowData.isStopped ( )

If this flag is set to true, future FlowElements will not process this FlowData.

Returns
should stop processing

◆ process()

void fiftyone.pipeline.core.data.FlowData.process ( )

Process this FlowData via the owning Pipeline.

Once this method returns the FlowData will not be changed further and cannot be processed again.

◆ stop()

void fiftyone.pipeline.core.data.FlowData.stop ( )

Set the stop flag.

See also
isStopped

◆ tryGetEvidence()

<T> TryGetResult<T> fiftyone.pipeline.core.data.FlowData.tryGetEvidence ( String   key,
Class< T >   type  
)

Try to get the data value from evidence.

Parameters
key - evidence key to get the value of
type - the type of value to get
<T> - the type of value to get
Returns
a 'true' TryGetResult if a value for a given key is found and a 'false' TryGetResult if the key is not found or if the method cannot cast the value to the requested type.

◆ tryGetValue()

<T extends ElementData> TryGetResult<T> fiftyone.pipeline.core.data.FlowData.tryGetValue ( TypedKey< T >   key )

Check if the flow data contains an item with the specified key name and type.

If it does exist, retrieve it.

Parameters
key - the key to check for
<T> - the type of value to return
Returns
a 'true' TryGetResult if an entry matching the key exists, a 'false' TryGetResult otherwise