All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.virtdata.docsys.metafs.fs.renderfs.api.Versioned Maven / Gradle / Ivy

package io.virtdata.docsys.metafs.fs.renderfs.api;

/**
 * Versioned objects have a long property that can be used as a version.
 * A versioned object is considered valid for a version if
 * and only if it has the same version.
 */
public interface Versioned {

    /**
     * Get the version for this element. An element is considered valid only
     * for other elements of the same version.
     */
    long getVersion();

    /**
     * A versioned object is valid for another versioned object if they have
     * the same version number.
     * @param other Another version object to check validity against
     * @return true, if the versions match
     */
    default boolean isValidFor(Versioned other) {
        return getVersion()==other.getVersion();
    }

    /**
     * A versioned object is only valid for the specific version it has.
     * @param version The version number to check validity against
     * @return true, if the version matches the provided version
     */
    default boolean isValidFor(long version) {
        return getVersion()==version;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy