Class Context

java.lang.Object
tech.deplant.java4ever.binding.Context

public final class Context extends Object
Class that represents the established environment inside EVER-SDK and is identified by id number. Holds last request id and functions to call SDK methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Context(int id, int requestCount, long timeout, com.fasterxml.jackson.databind.ObjectMapper mapper)
    Constructo of EVER-SDK context
  • Method Summary

    Modifier and Type
    Method
    Description
    <T, P> T
    call(String functionName, P params, Class<T> clazz)
    Most used call to EVER-SDK with some output object
    <T, P, A> T
    callAppObject(String functionName, P params, A appObject, Class<T> clazz)
    Call for methods that use app_object as one of params
    <T, P, E extends ExternalEvent>
    T
    callEvent(String functionName, P params, Consumer<E> consumer, Class<T> clazz)
    Call that uses event as consumer param
    <P> void
    callVoid(String functionName, P params)
    Calls to EVER-SDK without outputs
    int
    id()
     
    com.fasterxml.jackson.databind.ObjectMapper
     
    int
     
    long
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Context

      public Context(int id, int requestCount, long timeout, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Constructo of EVER-SDK context
      Parameters:
      id - number of context received from EVER-SDK, it's provided in contextBuilder.buildNew(loader). You can call it manually from EverSdkBridge.tcCreateContext(), but it's recommended to use ContextBuilder.
      requestCount - it's 0 for new contexts or last request id for 'loaded' ones
      timeout - timeout for operations in milliseconds
      mapper - Jackson's ObjectMapper, ContextBuilder have correctly preconfigured one.
  • Method Details

    • mapper

      public com.fasterxml.jackson.databind.ObjectMapper mapper()
    • timeout

      public long timeout()
    • callAppObject

      public <T, P, A> T callAppObject(String functionName, P params, A appObject, Class<T> clazz) throws EverSdkException
      Call for methods that use app_object as one of params
      Type Parameters:
      T -
      P -
      A -
      Parameters:
      functionName -
      params -
      appObject -
      clazz -
      Returns:
      Throws:
      EverSdkException
    • callEvent

      public <T, P, E extends ExternalEvent> T callEvent(String functionName, P params, Consumer<E> consumer, Class<T> clazz) throws EverSdkException
      Call that uses event as consumer param
      Type Parameters:
      T -
      P -
      E -
      Parameters:
      functionName -
      params -
      consumer -
      clazz -
      Returns:
      Throws:
      EverSdkException
    • call

      public <T, P> T call(String functionName, P params, Class<T> clazz) throws EverSdkException
      Most used call to EVER-SDK with some output object
      Type Parameters:
      T -
      P -
      Parameters:
      functionName -
      params - record of input type, usually ParamsOf...
      clazz - class of output type record, usually ResultOf...class
      Returns:
      output type record, usually ResultOf...
      Throws:
      EverSdkException
    • callVoid

      public <P> void callVoid(String functionName, P params) throws EverSdkException
      Calls to EVER-SDK without outputs
      Type Parameters:
      P -
      Parameters:
      functionName -
      params -
      Throws:
      EverSdkException
    • id

      public int id()
    • requestCount

      public int requestCount()