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

io.github.mike10004.containment.lifecycle.CacheableLifecycledResource Maven / Gradle / Ivy

The newest version!
package io.github.mike10004.containment.lifecycle;

import java.util.StringJoiner;

import static java.util.Objects.requireNonNull;

class CacheableLifecycledResource implements LifecycledResource {

    private final LifecyclingCachingProvider containerProvider;

    public CacheableLifecycledResource(LifecyclingCachingProvider containerProvider) {
        this.containerProvider = requireNonNull(containerProvider, "containerProvider");
    }

    @Override
    public Provision request() {
        return containerProvider.provide();
    }

    @Override
    public void finishLifecycle() {
        containerProvider.finishLifecycle();
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", getClass().getSimpleName() + "[", "]")
                .add("containerProvider=" + containerProvider)
                .toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy