public static Object resolveInput(String input) throws Exception { int p = input.indexOf(':'); if (p <= 0) { throw new IllegalArgumentException(input + " is not formatted using type:value"); } String type = input.substring(0, p); String ref = input.substring(p + 1); InputResolver<?> ir = inputResolvers.get(type); if (ir != null) { return ir.getInput(ref); } throw new IllegalArgumentException( "Unsupported managed object. Don't know how to get referebce from: " + input); }
public static void addInputResolver(InputResolver<?> resolver) { inputResolvers.put(resolver.getType(), resolver); }