name.remal.gradle_plugins.toolkit.cache.ToolkitCacheKeyNormalizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolkit Show documentation
Show all versions of toolkit Show documentation
toolkit: toolkit: toolkit
package name.remal.gradle_plugins.toolkit.cache;
import static name.remal.gradle_plugins.toolkit.FileUtils.normalizeFile;
import static name.remal.gradle_plugins.toolkit.PathUtils.normalizePath;
import java.io.File;
import java.nio.file.Path;
@FunctionalInterface
public interface ToolkitCacheKeyNormalizer {
Key normalizeKey(Key key) throws Throwable;
default ToolkitCacheKeyNormalizer then(ToolkitCacheKeyNormalizer other) {
return key -> {
key = this.normalizeKey(key);
key = other.normalizeKey(key);
return key;
};
}
@SuppressWarnings("unchecked")
static ToolkitCacheKeyNormalizer defaultToolkitCacheKeyNormalizer() {
return key -> {
if (key instanceof Path) {
return (Key) normalizePath((Path) key);
} else if (key instanceof File) {
return (Key) normalizeFile((File) key);
} else {
return key;
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy