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

io.sphere.sdk.models.Versioned Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.models;

/**
 * Something that has an ID and a version.
 *
 * @param  The type which has an ID and version.
 */
public interface Versioned extends Identifiable {
    @Override
    String getId();

    Long getVersion();

    /**
     * Creates a versioned that only contains the id and the version.
     * @param versioned the template object to use its ID and version
     * @param  The type which has an ID and version.
     * @return versioned
     */
    static  Versioned of(final Versioned versioned) {
        return of(versioned.getId(), versioned.getVersion());
    }

    static  Versioned of(final String id, final long version) {
        return new SimpleVersioned<>(id, version);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy