Package bm.machine

Interface StateProvider

All Known Subinterfaces:
FileState, Target
All Known Implementing Classes:
FileBooleanState, FileContentState, FileTarget, FixedStateTarget, StringTarget
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StateProvider
Helps to manage the state of a target by persisting its state separately from it to be able to detect when the target and its safed state deviate.

Extracting the state provider from the Target interface, makes it easier to work with pluggable state providers.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addState(Consumer<byte[]> sink)
    Given a sink for byte[] this method should provide bytes representing a target's value.
  • Method Details

    • addState

      void addState(Consumer<byte[]> sink) throws BuildProblemException
      Given a sink for byte[] this method should provide bytes representing a target's value. If the value changes, the bytes provided must change too. But the bytes may also change if the value was not actually changed, though this will result in unnecessary builts of a target.

      This should not mingle in any dependency data.

      As examples consider the full byte content of a file or only its last modified time. The latter changes even if a file is overwritten by itself, but for some cases, i.e. huge files, the time stamp may be preferable.

      Parameters:
      sink - into which to fill the state representing bytes
      Throws:
      BuildProblemException - as needed