@SuppressWarnings({"unchecked"}) public Object invoke(Object proxy, Method method, Object[] args) { if (method.equals(this.completeMethod)) { int result = complete((String)args[0], ((Integer) args[1]).intValue(), (List<String>) args[2]); return Integer.valueOf(result); } throw new NoSuchMethodError(method.toString()); }
Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); m.invoke(reader, completor);
private static JLineShellConsoleV2 getJLineShellConsoleV2( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompleter(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.console.completer.Completer"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompleter", new Class[] {completorClass}, completor); return new JLineShellConsoleV2(reader, cs); } }
private static JLineShellConsoleV1 getJLineShellConsoleV1( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompletor(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.Completor"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompletor", new Class[] {completorClass}, completor); return new JLineShellConsoleV1(reader, cs); }
@SuppressWarnings({"unchecked"}) public Object invoke(Object proxy, Method method, Object[] args) { if (method.equals(this.completeMethod)) { int result = complete((String)args[0], ((Integer) args[1]).intValue(), (List<String>) args[2]); return Integer.valueOf(result); } throw new NoSuchMethodError(method.toString()); }
private static JLineShellConsoleV1 getJLineShellConsoleV1( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompletor(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.Completor"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompletor", new Class[] {completorClass}, completor); return new JLineShellConsoleV1(reader, cs); }
@SuppressWarnings({"unchecked"}) public Object invoke(Object proxy, Method method, Object[] args) { if (method.equals(this.completeMethod)) { int result = complete((String)args[0], ((Integer) args[1]).intValue(), (List<String>) args[2]); return Integer.valueOf(result); } throw new NoSuchMethodError(method.toString()); }
private static JLineShellConsoleV2 getJLineShellConsoleV2( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompleter(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.console.completer.Completer"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompleter", new Class[] {completorClass}, completor); return new JLineShellConsoleV2(reader, cs); } }