Class ContextBuilder

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

public class ContextBuilder extends Object
Builder to correctly request and create Context object
  • Field Details

    • DEFAULT_MAPPER

      public static final com.fasterxml.jackson.databind.ObjectMapper DEFAULT_MAPPER
  • Constructor Details

    • ContextBuilder

      public ContextBuilder()
  • Method Details

    • setConfigJson

      public ContextBuilder setConfigJson(String configJson)
    • setTimeout

      public ContextBuilder setTimeout(long timeout)
      Sets timeout for EVER-SDK responses
      Parameters:
      timeout - Response completion waiting timeout (in milliseconds)
      Returns:
      instance of builder
    • setMapper

      public ContextBuilder setMapper(com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
    • buildFromExisting

      public Context buildFromExisting(int existingContextId, int existingContextRequestCount)
      If you, for some reason, can't directly access already created Context object, but you're sure that it is created, loaded and you know it's id and last request count, you should use this method to load Context object out of this data. It's up to you if id and request count are correct, it will not be checked until you start calls with Context.
      Parameters:
      existingContextId - id of existing, previously created Context in EVER-SDK
      existingContextRequestCount - last request number of previously created Context in EVER-SDK
      Returns:
      Context object made of provided data
    • buildNew

      public Context buildNew(LibraryLoader loader) throws com.fasterxml.jackson.core.JsonProcessingException
      Terminal builder method to create new Context
      Parameters:
      loader - Specify how exactly ton_client library will be found and loaded
      Returns:
      Context object that can be used in calls to EVER-SDK, ton_client library is loaded and called in the process
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException