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

org.jtwig.reflection.resolver.argument.InputArgumentResolver Maven / Gradle / Ivy

There is a newer version: 5.87.0.RELEASE
Show newest version
package org.jtwig.reflection.resolver.argument;

import com.google.common.base.Optional;
import org.jtwig.reflection.input.InputParameterResolverContext;
import org.jtwig.reflection.model.Value;
import org.jtwig.reflection.model.java.JavaMethodArgument;

public class InputArgumentResolver implements ArgumentResolver {
    private final InputArgumentValueResolver resolver;
    private final InputParameterResolverContext context;

    public InputArgumentResolver(InputArgumentValueResolver resolver,
                                 InputParameterResolverContext context) {
        this.resolver = resolver;
        this.context = context;
    }

    @Override
    public Optional resolve(final JavaMethodArgument methodArgument) {
        InputParameterResolverContext clonedContext = context.clone();

        Optional result = resolver.resolve(methodArgument, clonedContext);

        if (result.isPresent()) {
            context.merge(clonedContext);
        }

        return result;
    }

    public boolean isFullyResolved () {
        return context.fullyUsed();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy