Package com.yahoo.language.process
Class InvocationContext<SUBCLASS extends InvocationContext<SUBCLASS>>
java.lang.Object
com.yahoo.language.process.InvocationContext<SUBCLASS>
- Direct Known Subclasses:
Chunker.Context,Embedder.Context,FieldGenerator.Context
Context of an invocation of a component carrying out a processing task.
- Author:
- bratseth
-
Constructor Summary
ConstructorsModifierConstructorDescriptionInvocationContext(String destination) InvocationContext(String destination, Map<Object, Object> cache) protectedInvocationContext(SUBCLASS other) -
Method Summary
Modifier and TypeMethodDescription<T> TcomputeCachedValueIfAbsent(Object key, Supplier<? extends T> supplier) Returns the cached value, or computes and caches it if not present.getCache()getCachedValue(Object key) Returns a cached value, or null if not present.Return the component id or 'unknown' if not set.Returns the name of the recipient of this invocation.Returns the language of the text, or UNKNOWN (default) to use a language independent invocation.voidputCachedValue(Object key, Object value) setComponentId(String componentId) Sets the component id.setDestination(String destination) Sets the name of the recipient of this invocation.setLanguage(Language language) Sets the language of the text, or UNKNOWN to use language a independent invocation.
-
Constructor Details
-
InvocationContext
-
InvocationContext
- Parameters:
destination- the name of the recipient of this invocationcache- a cache shared between all invocations for a single request
-
InvocationContext
-
-
Method Details
-
getLanguage
Returns the language of the text, or UNKNOWN (default) to use a language independent invocation. -
setLanguage
Sets the language of the text, or UNKNOWN to use language a independent invocation. -
getDestination
Returns the name of the recipient of this invocation.This is either a query feature name ("query(feature)"), or a schema and field name concatenated by a dot ("schema.field"). This cannot be null.
-
setDestination
Sets the name of the recipient of this invocation.This is either a query feature name ("query(feature)"), or a schema and field name concatenated by a dot ("schema.field").
-
getComponentId
Return the component id or 'unknown' if not set. -
setComponentId
Sets the component id. -
getCache
-
putCachedValue
-
getCachedValue
Returns a cached value, or null if not present. -
computeCachedValueIfAbsent
Returns the cached value, or computes and caches it if not present.
-