org.jtwig.reflection.resolver.argument.ParameterResolver Maven / Gradle / Ivy
package org.jtwig.reflection.resolver.argument;
import com.google.common.base.Optional;
import com.google.common.base.Supplier;
import org.jtwig.reflection.model.Value;
import org.jtwig.reflection.model.java.JavaMethodArgument;
import org.jtwig.reflection.util.Optionals;
public class ParameterResolver {
private final ArgumentResolver argumentResolver;
public ParameterResolver(ArgumentResolver argumentResolver) {
this.argumentResolver = argumentResolver;
}
public Optional resolve (InputArgumentResolver inputArgumentResolver, JavaMethodArgument methodArgument) {
return Optionals
.orOptionalSupplier(
inputArgumentResolver.resolve(methodArgument),
resolveStaticArgument(methodArgument));
}
private Supplier> resolveStaticArgument(final JavaMethodArgument javaMethodArgument) {
return new Supplier>() {
@Override
public Optional get() {
return argumentResolver.resolve(javaMethodArgument);
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy