Class AbstractBindingHarness

    • Field Detail

      • typeCode

        protected final java.lang.String typeCode
      • binding

        protected final Binding binding
      • targetProperty

        protected final PropertyKey targetProperty
      • transforms

        @Nullable
        protected final Transform[] transforms
        List of transforms or null if no transforms (never empty)
      • shutdown

        protected boolean shutdown
    • Method Detail

      • mdcTeardown

        public void mdcTeardown()
        Description copied from interface: LoggingContext
        Tear down the MDC keys that are added in #mdcSetup
        Specified by:
        mdcTeardown in interface LoggingContext
      • startup

        public void startup()
        Must be called on-queue
      • subscribeToTarget

        @Nullable
        protected abstract java.lang.Runnable subscribeToTarget​(java.util.function.Consumer<PropertyTreeChangeEvent> callback)
        Attempt to subscribe to the target property.
        Parameters:
        callback - When the target property changes, call this consumer and give it a way to fetch the new value
        Returns:
        A runnable which when called will tear down the subscription. May be null if the subscription wasn't able to be established.
      • shutdown

        public void shutdown()
        Must be called on-queue
      • publish

        public void publish​(QualifiedValue value,
                            boolean pending)
        Description copied from interface: BindingContext
        Called from the binding when it has a value to push onto the target property ( or through its transforms )
        Specified by:
        publish in interface BindingContext
        pending - true if this value is temporary and will be replaced (within a reasonable span of time) with a new value
      • processPublishedValue

        public void processPublishedValue()
        Description copied from interface: BindingContext
        Takes the most recently published value from the binding and runs it through the transforms or delivers it to the target if there are no transforms.
        Specified by:
        processPublishedValue in interface BindingContext
      • refresh

        public void refresh()
      • onBindingProducedValue

        protected void onBindingProducedValue​(long sequence,
                                              QualifiedValue value)
      • onTransformProducedValue

        protected void onTransformProducedValue​(int transformIndex,
                                                long sequence,
                                                QualifiedValue transformedValue)
      • writeToTarget

        protected abstract void writeToTarget​(QualifiedValue value)
        Write the given value to the target property.