com.softicar.platform.common.io.resource.hash.AbstractHashableResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.io.resource.hash;
import com.softicar.platform.common.io.resource.IResource;
import java.util.Optional;
/**
* Abstract implementation of {@link IResource#getContentHash()}.
*
* The computation of the {@link IResource} content hash is done only on demand
* and then cached for consecutive calls.
*
* @author Oliver Richers
*/
public abstract class AbstractHashableResource implements IResource {
private final LazyResourceHasher hasher;
public AbstractHashableResource() {
this.hasher = new LazyResourceHasher(this);
}
@Override
public final Optional getContentHash() {
return Optional.of(hasher.getHash());
}
}