Package com.tangosol.util.processor
Class ScriptProcessor<K,V,R>
- java.lang.Object
-
- com.tangosol.util.AbstractScript
-
- com.tangosol.util.processor.ScriptProcessor<K,V,R>
-
- Type Parameters:
K
- the type of the Map entry keyV
- the type of the Map entry valueR
- the type of value returned by theInvocableMap.EntryProcessor
- All Implemented Interfaces:
ExternalizableLite
,PortableObject
,InvocableMap.EntryProcessor<K,V,R>
,Serializable
public class ScriptProcessor<K,V,R> extends AbstractScript implements InvocableMap.EntryProcessor<K,V,R>
ScriptProcessor is anInvocableMap.EntryProcessor
that wraps a script written in one of the languages supported by Graal VM.- Since:
- 14.1.1.0
- Author:
- mk 2019.07.26
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.tangosol.util.AbstractScript
m_aoArgs, m_sLanguage, m_sName
-
-
Constructor Summary
Constructors Constructor Description ScriptProcessor()
Default constructor for deserialization.ScriptProcessor(String language, String name, Object... args)
Create aScriptProcessor
that wraps a script written in the specified language and identified by the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description R
process(InvocableMap.Entry<K,V> entry)
Process a Map.Entry object.-
Methods inherited from class com.tangosol.util.AbstractScript
getArgs, getLanguage, getName, readExternal, readExternal, writeExternal, writeExternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.util.InvocableMap.EntryProcessor
processAll
-
-
-
-
Constructor Detail
-
ScriptProcessor
public ScriptProcessor()
Default constructor for deserialization.
-
ScriptProcessor
public ScriptProcessor(String language, String name, Object... args)
Create aScriptProcessor
that wraps a script written in the specified language and identified by the specified name. The specified args will be passed during execution of the script.- Parameters:
language
- the language the script is written. Currently, only "js" (for JavaScript) is supportedname
- the name of theInvocableMap.EntryProcessor
that needs to be executedargs
- the arguments to be passed to theInvocableMap.EntryProcessor
-
-
Method Detail
-
process
public R process(InvocableMap.Entry<K,V> entry)
Description copied from interface:InvocableMap.EntryProcessor
Process a Map.Entry object.Note: if this method throws an exception, all modifications to the supplied entry or any other entries retrieved via the
BackingMapContext.getBackingMapEntry(java.lang.Object)
API will be rolled back leaving all underlying values unchanged.- Specified by:
process
in interfaceInvocableMap.EntryProcessor<K,V,R>
- Parameters:
entry
- the Entry to process- Returns:
- the result of the processing, if any
-
-