in sdk/src/main/java/com/google/cloud/dataflow/sdk/options/ProxyInvocationHandler.java [105:140]
public Object invoke(Object proxy, Method method, Object[] args) {
if (args == null && "toString".equals(method.getName())) {
return toString();
} else if (args != null && args.length == 1 && "equals".equals(method.getName())) {
return equals(args[0]);
} else if (args == null && "hashCode".equals(method.getName())) {
return hashCode();
} else if (args != null && "as".equals(method.getName()) && args[0] instanceof Class) {
@SuppressWarnings("unchecked")
Class<? extends PipelineOptions> clazz = (Class<? extends PipelineOptions>) args[0];
return as(clazz);
} else if (args != null && "cloneAs".equals(method.getName()) && args[0] instanceof Class) {
@SuppressWarnings("unchecked")
Class<? extends PipelineOptions> clazz = (Class<? extends PipelineOptions>) args[0];
return cloneAs(proxy, clazz);
}
String methodName = method.getName();
synchronized (this) {
if (gettersToPropertyNames.keySet().contains(methodName)) {
String propertyName = gettersToPropertyNames.get(methodName);
if (!options.containsKey(propertyName)) {
// Lazy bind the default to the method.
Object value = jsonOptions.containsKey(propertyName)
? getValueFromJson(propertyName, method)
: getDefault((PipelineOptions) proxy, method);
options.put(propertyName, value);
}
return options.get(propertyName);
} else if (settersToPropertyNames.containsKey(methodName)) {
options.put(settersToPropertyNames.get(methodName), args[0]);
return Void.TYPE;
}
}
throw new RuntimeException("Unknown method [" + method + "] invoked with args ["
+ Arrays.toString(args) + "].");
}