

package org.gradle.workers.internal;

import org.gradle.internal.isolation.Isolatable;
import org.gradle.workers.WorkAction;
import org.gradle.workers.WorkParameters;

public class IsolatedParametersActionExecutionSpec<T extends WorkParameters> implements ActionExecutionSpec<T> {
    private final String displayName;
    private final Class<? extends WorkAction<T>> implementationClass;
    private final Isolatable<T> isolatedParams;
    private final ClassLoaderStructure classLoaderStructure;

    public IsolatedParametersActionExecutionSpec(Class<? extends WorkAction<T>> implementationClass, String displayName, Isolatable<T> isolatedParams, ClassLoaderStructure classLoaderStructure) {
        this.implementationClass = implementationClass;
        this.displayName = displayName;
        this.isolatedParams = isolatedParams;
        this.classLoaderStructure = classLoaderStructure;
    }

    @Override
    public Class<? extends WorkAction<T>> getImplementationClass() {
        return implementationClass;
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    @Override
    public T getParameters() {
        return isolatedParams.isolate();
    }

    @Override
    public ClassLoaderStructure getClassLoaderStructure() {
        return classLoaderStructure;
    }

    public Isolatable<T> getIsolatedParams() {
        return isolatedParams;
    }
}
