Class InvocationContext<SUBCLASS extends InvocationContext<SUBCLASS>>

java.lang.Object
com.yahoo.language.process.InvocationContext<SUBCLASS>
Direct Known Subclasses:
Chunker.Context, Embedder.Context, FieldGenerator.Context

public class InvocationContext<SUBCLASS extends InvocationContext<SUBCLASS>> extends Object
Context of an invocation of a component carrying out a processing task.
Author:
bratseth
  • Constructor Details

    • InvocationContext

      public InvocationContext(String destination)
    • InvocationContext

      public InvocationContext(String destination, Map<Object,Object> cache)
      Parameters:
      destination - the name of the recipient of this invocation
      cache - a cache shared between all invocations for a single request
    • InvocationContext

      protected InvocationContext(SUBCLASS other)
  • Method Details

    • getLanguage

      public Language getLanguage()
      Returns the language of the text, or UNKNOWN (default) to use a language independent invocation.
    • setLanguage

      public SUBCLASS setLanguage(Language language)
      Sets the language of the text, or UNKNOWN to use language a independent invocation.
    • getDestination

      public String 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

      public SUBCLASS setDestination(String destination)
      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

      public String getComponentId()
      Return the component id or 'unknown' if not set.
    • setComponentId

      public SUBCLASS setComponentId(String componentId)
      Sets the component id.
    • getCache

      protected Map<Object,Object> getCache()
    • putCachedValue

      public void putCachedValue(Object key, Object value)
    • getCachedValue

      public Object getCachedValue(Object key)
      Returns a cached value, or null if not present.
    • computeCachedValueIfAbsent

      public <T> T computeCachedValueIfAbsent(Object key, Supplier<? extends T> supplier)
      Returns the cached value, or computes and caches it if not present.