com.tibbo.aggregate.common.binding

## Interface BindingProvider<T>

- All Known Implementing Classes:
    AbstractBindingProvider, AbstractDataTableBindingProvider, DataTableBindingProvider

      public interface BindingProvider<T>

  BindingProvider interacts with `BindingProcessor` by providing available bindings and then reacting to their executions.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addReferenceListener(Reference ref, ReferenceListener<T> listener)` Method called by the binding processor once the provider should start listening for certain `Reference` changes.
    `java.util.Map<Binding,EvaluationOptions>` | `createBindings()` Returns bindings provided by the Provider.
    `java.util.List<Reference>` | `getReferences(Binding binding)` Returns list of references of a particular binding.
    `void` | `processError(Binding binding, int method, Reference cause, java.lang.Exception error)` Method used to handle binding processing error.
    `void` | `processExecution(int event, Binding binding, EvaluationOptions options, Reference cause, java.lang.Object result)` Method used to handle execution of a binding.
    `void` | `removeReferenceListener(ReferenceListener<T> listener)` Method called by the binding processor once the provider should no longer listen for changes of a `Reference`.
    `void` | `start()` Method called by `BindingProcessor` upon its startup.
    `void` | `stop()` Method called by `BindingProcessor` upon its termination.
    `void` | `writeReference(int method, Binding binding, Reference cause, java.lang.Object value, ChangeCache cache, Pinpoint pinpoint)` Method is called once a binding was executed, its expression evaluated to some result and the provider needs to write the result into binding target.

- - ### Method Detail

    - #### createBindings

          java.util.Map<Binding,EvaluationOptions> createBindings()

      Returns bindings provided by the Provider.
      Returns:
        Map of bindings and their `EvaluationOptions`

    - #### start

          void start()

      Method called by `BindingProcessor` upon its startup. Should implement initialization logic.

    - #### stop

          void stop()

      Method called by `BindingProcessor` upon its termination. Should implement cleanup logic.

    - #### getReferences

          java.util.List<Reference> getReferences(Binding binding)
                                           throws BindingException

      Returns list of references of a particular binding.
      Returns:
        List of references found in a binding.
      Throws:
        `BindingException`

    - #### writeReference

          void writeReference(int method,
                              Binding binding,
                              Reference cause,
                              java.lang.Object value,
                              @Nullable
                              ChangeCache cache,
                              @Nullable
                              Pinpoint pinpoint)
                       throws BindingException

      Method is called once a binding was executed, its expression evaluated to some result and the provider needs to write the result into binding target.
      Parameters:
        `method` - Binding execution method: EvaluationOptions.STARTUP, EvaluationOptions.EVENT or EvaluationOptions.PERIODIC
        `binding` - The `Binding` itself
        `cause` - Execution cause
        `value` - Value to write to the target
        `cache` - Change cache
        `pinpoint` - Origin of the writing
      Throws:
        `BindingException` - if writing was not successful

    - #### addReferenceListener

          void addReferenceListener(Reference ref,
                                    ReferenceListener<T> listener)
                             throws BindingException

      Method called by the binding processor once the provider should start listening for certain `Reference` changes.
      Parameters:
        `ref` - Reference to listen
        `listener` - Listener that should be called if the reference was changed
      Throws:
        `BindingException` - If a listening could not be started

    - #### removeReferenceListener

          void removeReferenceListener(ReferenceListener<T> listener)

      Method called by the binding processor once the provider should no longer listen for changes of a `Reference`.
      Parameters:
        `listener` - Listener to remove

    - #### processExecution

          void processExecution(int event,
                                Binding binding,
                                EvaluationOptions options,
                                Reference cause,
                                java.lang.Object result)

      Method used to handle execution of a binding.

    - #### processError

          void processError(Binding binding,
                            int method,
                            Reference cause,
                            java.lang.Exception error)

      Method used to handle binding processing error.