
com.github.peterbecker.configuration.parser.ConfigurationInvocationHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of configuration-parser Show documentation
Show all versions of configuration-parser Show documentation
Parser and command line handling for configuration.
package com.github.peterbecker.configuration.parser;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Map;
/**
* Binds calls to the configuration interface to the data extracted.
*/
public class ConfigurationInvocationHandler implements InvocationHandler {
private final Class configurationInterface;
private final Map data;
public ConfigurationInvocationHandler(Class configurationInterface, Map data) {
this.configurationInterface = configurationInterface;
this.data = data;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
assert configurationInterface.isAssignableFrom(proxy.getClass());
assert args == null;
return data.get(method.getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy