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

dev.vality.woody.api.proxy.SpawnTargetProvider Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package dev.vality.woody.api.proxy;

import java.util.function.Supplier;

public class SpawnTargetProvider implements InvocationTargetProvider {
    private final Class targetType;
    private final Supplier supplier;

    public SpawnTargetProvider(Class targetType, Supplier supplier) {
        this.targetType = targetType;
        this.supplier = supplier;
    }

    @Override
    public T getTarget() {
        return createTarget();
    }

    @Override
    public Class getTargetType() {
        return targetType;
    }

    @Override
    public void releaseTarget(T target) {
    }

    @Override
    public boolean isSingleTarget() {
        return false;
    }

    protected T createTarget() {
        return supplier.get();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy