Class VersionData

  • All Implemented Interfaces:
    Versioned

    public class VersionData
    extends java.lang.Object
    implements Versioned
    VersionsData provides a default implementation of the Versioned interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      VersionData()  
      VersionData​(Versioned... dependencies)
      Initialize versions with dependencies only.
      VersionData​(java.util.function.LongSupplier... versionSources)
      Initialize versions with multiple parts, each having their own way of reading a version value.
      VersionData​(java.util.function.LongSupplier thisVersionSource, Versioned... dependencies)
      Initialize version data with a separate version source for this element's computed state, as well as references to the dependencies which that state may rely on.
    • Method Summary

      Modifier and Type Method Description
      void addVersionDependency​(Versioned... dep)  
      long getMaxDependencyVersion()  
      long getVersion()
      Get the version for this element.
      boolean isValid()
      If all the versioned parts of this elements are equal or higher version than all of the dependencies, then this element is valid.
      • Methods inherited from class java.lang.Object

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

      • VersionData

        public VersionData()
      • VersionData

        public VersionData​(java.util.function.LongSupplier... versionSources)
        Initialize versions with multiple parts, each having their own way of reading a version value.
        Parameters:
        versionSources - version suppliers for each part of this whole element
      • VersionData

        public VersionData​(Versioned... dependencies)
        Initialize versions with dependencies only. In this form, the effective version of this element is calculated statically as the lowest version of all dependencies at the time of the call.
        Parameters:
        dependencies - The dependencies of this element as its parts.
      • VersionData

        public VersionData​(java.util.function.LongSupplier thisVersionSource,
                           Versioned... dependencies)
        Initialize version data with a separate version source for this element's computed state, as well as references to the dependencies which that state may rely on.
        Parameters:
        thisVersionSource - A way to derive this element's version value.
        dependencies - A set of dependencies which may invalidate the state of this element.
    • Method Detail

      • getVersion

        public long getVersion()
        Get the version for this element. An element is considered valid only for other elements of the same version.
        Specified by:
        getVersion in interface Versioned
        Returns:
        A long version for the versioned element.
      • getMaxDependencyVersion

        public long getMaxDependencyVersion()
      • addVersionDependency

        public void addVersionDependency​(Versioned... dep)
      • isValid

        public boolean isValid()
        Description copied from interface: Versioned
        If all the versioned parts of this elements are equal or higher version than all of the dependencies, then this element is valid. Said differently, if the highest version of all dependencies is equal to or lower than the lowest version of all the parts, then this element is valid.
        Specified by:
        isValid in interface Versioned
        Returns:
        true, if this element is valid with respect to dependencies.