@PSOperatorWrapper public class ItemOperators extends java.lang.Object
Constructor and Description |
---|
ItemOperators() |
Modifier and Type | Method and Description |
---|---|
static Function<Item,java.lang.Boolean> |
containsField(java.lang.String fieldToCheck)
Check whether the item contains a given field.
|
static Function<Item,Item> |
excludeFields(java.lang.String... fieldsToExclude)
Project an item by excluding some fields.
|
static <TValue> Function<Item,TValue> |
getField(java.lang.String field)
Get the value of a given field in the item.
|
static Function<Item,Item> |
getSubItem(java.lang.String subItemField)
Get the sub item value of a given field.
|
static Function<Item,Item> |
includeFields(java.lang.String... fieldsToInclude)
Project an item by including some fields.
|
static <TValue> Function<Item,java.lang.Boolean> |
isFieldIn(java.lang.String field,
TValue[] listToCompare)
Check whether the value of a field is in a given list.
|
static <TValue> Function<Item,Item> |
setField(java.lang.String fieldToSet,
Function<Item,TValue> fieldValueComputer)
Set the value of a new field with a function.
|
static <TValue> Function<Item,Item> |
setField(java.lang.String fieldToSet,
TValue fieldValue)
Set the value of a new field to a given value.
|
static <TValue> Function<Item,Item> |
setGroupField(java.lang.String fieldToSet,
Function<java.util.List<Item>,TValue> fieldValueComputer)
Set a field to a new value for each item in the stream.
|
static <TValue> Function<Item,Item> |
setIndependentField(java.lang.String fieldToSet,
Function<java.lang.Void,TValue> valueGenerator)
Set the value of a new field with a value generator function.
|
static <Tout> Function<Item,Tout> |
wrapSubStreamFunction(Function<java.util.List<Item>,Tout> subStreamFunction)
Output the grouped items in the item with a function.
|
static <Tout> Function<Item,Tout> |
wrapValueGenerator(Function<java.lang.Void,Tout> valueGenerator)
Wrap a valueGenerator that takes Void as input type to a function that takes Item as input type.
|
public static <TValue> Function<Item,java.lang.Boolean> isFieldIn(java.lang.String field, TValue[] listToCompare)
TValue
- the type of list elementsfield
- the field namelistToCompare
- the list to check whether the field is inpublic static Function<Item,java.lang.Boolean> containsField(java.lang.String fieldToCheck)
fieldToCheck
- the name of field to checkpublic static <TValue> Function<Item,TValue> getField(java.lang.String field)
TValue
- the type of field valuefield
- the name of the field to get.public static <Tout> Function<Item,Tout> wrapSubStreamFunction(Function<java.util.List<Item>,Tout> subStreamFunction)
Tout
- the type of sub stream collection result.subStreamFunction
- the function to output sub stream.public static <Tout> Function<Item,Tout> wrapValueGenerator(Function<java.lang.Void,Tout> valueGenerator)
Tout
- the type of value generator result.valueGenerator
- the function that takes Void as input.public static <TValue> Function<Item,Item> setGroupField(java.lang.String fieldToSet, Function<java.util.List<Item>,TValue> fieldValueComputer)
TValue
- the type of the new field valuefieldToSet
- the new field namefieldValueComputer
- the function to compute the new field value, which takes the list of grouped items as input.public static <TValue> Function<Item,Item> setIndependentField(java.lang.String fieldToSet, Function<java.lang.Void,TValue> valueGenerator)
TValue
- the type of the new field value.fieldToSet
- the name of the field to set, it can be a new name or an existing name.valueGenerator
- the function to compute the field value.public static <TValue> Function<Item,Item> setField(java.lang.String fieldToSet, Function<Item,TValue> fieldValueComputer)
TValue
- the type of the new field value.fieldToSet
- the name of the field to set, it can be a new name.fieldValueComputer
- the function to compute the value of the field based on the item.public static <TValue> Function<Item,Item> setField(java.lang.String fieldToSet, TValue fieldValue)
TValue
- the type of the new field value.fieldToSet
- the name of the field to set, it can be a new name.fieldValue
- the value of the field.public static Function<Item,Item> includeFields(java.lang.String... fieldsToInclude)
fieldsToInclude
- the names of the fields to include.public static Function<Item,Item> excludeFields(java.lang.String... fieldsToExclude)
fieldsToExclude
- the names of the fields to exclude.