public final void setProperty(String property, Object newValue) { try { getMetaClass().setProperty(this, property, newValue); } catch (MissingPropertyException e) { context.getSession().put(property, newValue); } }
public final Object getProperty(String property) { if (context instanceof InvocationContext<?>) { PipeLineClosure ret = Helper.resolveProperty((InvocationContext)context, property); if (ret != null) { return ret; } } try { return getMetaClass().getProperty(this, property); } catch (MissingPropertyException e) { return context.getSession().get(property); } }
public static Object invokeMethod(RuntimeContext context, String name, Object args, MissingMethodException ex) { if (context instanceof InvocationContext<?>) { SafeCallable executed = Helper.resolveMethodInvocation((InvocationContext)context, name, args); if (executed != null) { return executed.call(); } } // Object o = context.getSession().get(name); if (o instanceof Closure) { Closure closure = (Closure)o; if (args instanceof Object[]) { Object[] array = (Object[])args; if (array.length == 0) { return closure.call(); } else { return closure.call(array); } } else { return closure.call(args); } } else { throw ex; } }
@Override public Completion complete(ParameterDescriptor parameter, String prefix) throws Exception { ShellSession session = (ShellSession)context.getSession(); Completion.Builder builder = Completion.builder(prefix); for (Language lang : session.getContext().getPlugins(Language.class)) { if (lang.isActive()) { if (lang.getRepl() != null) { String name = lang.getName(); if (name.startsWith(prefix)) { builder.add(name.substring(prefix.length()), true); } } } } return builder.build(); } }
public Completion complete(ParameterDescriptor parameter, String prefix) throws Exception { Object juu = context.getSession().get("juu"); Completion.Builder ret = Completion.builder(prefix); if (juu != null) { ret.add(juu.toString(), true); } return ret.build(); } @Command
@Override public final void setProperty(String property, Object newValue) { try { super.setProperty(property, newValue); } catch (MissingPropertyException e) { context.getSession().put(property, newValue); } } }
public final void setProperty(String property, Object newValue) { try { getMetaClass().setProperty(this, property, newValue); } catch (MissingPropertyException e) { context.getSession().put(property, newValue); } }
public final void setProperty(String property, Object newValue) { try { getMetaClass().setProperty(this, property, newValue); } catch (MissingPropertyException e) { context.getSession().put(property, newValue); } }
public void setContext(RuntimeContext context) { setBinding(new Binding(context.getSession())); }
public final Object getProperty(String property) { if (context instanceof InvocationContext<?>) { PipeLineClosure ret = Helper.resolveProperty((InvocationContext)context, property); if (ret != null) { return ret; } } try { return getMetaClass().getProperty(this, property); } catch (MissingPropertyException e) { return context.getSession().get(property); } }
public final Object getProperty(String property) { if (context instanceof InvocationContext<?>) { PipeLineClosure ret = Helper.resolveProperty((InvocationContext)context, property); if (ret != null) { return ret; } } try { return getMetaClass().getProperty(this, property); } catch (MissingPropertyException e) { return context.getSession().get(property); } }
public static Object invokeMethod(RuntimeContext context, String name, Object args, MissingMethodException ex) { if (context instanceof InvocationContext<?>) { SafeCallable executed = Helper.resolveMethodInvocation((InvocationContext)context, name, args); if (executed != null) { return executed.call(); } } // Object o = context.getSession().get(name); if (o instanceof Closure) { Closure closure = (Closure)o; if (args instanceof Object[]) { Object[] array = (Object[])args; if (array.length == 0) { return closure.call(); } else { return closure.call(array); } } else { return closure.call(args); } } else { throw ex; } }
public static Object invokeMethod(RuntimeContext context, String name, Object args, MissingMethodException ex) { if (context instanceof InvocationContext<?>) { SafeCallable executed = Helper.resolveMethodInvocation((InvocationContext)context, name, args); if (executed != null) { return executed.call(); } } // Object o = context.getSession().get(name); if (o instanceof Closure) { Closure closure = (Closure)o; if (args instanceof Object[]) { Object[] array = (Object[])args; if (array.length == 0) { return closure.call(); } else { return closure.call(array); } } else { return closure.call(args); } } else { throw ex; } }
@Override public final Object getProperty(String property) { if (context instanceof InvocationContext<?>) { CRaSH crash = (CRaSH)context.getSession().get("crash"); if (crash != null) { try { ShellCommand cmd = crash.getCommand(property); if (cmd != null) { return new ClassDispatcher(cmd, this); } } catch (NoSuchCommandException e) { throw new InvokerInvocationException(e); } } } // try { return super.getProperty(property); } catch (MissingPropertyException e) { return context.getSession().get(property); } }
CRaSH crash = (CRaSH)context.getSession().get("crash"); if (crash != null) { ShellCommand cmd; Object o = context.getSession().get(name); if (o instanceof Closure) { Closure closure = (Closure)o;
@Override public Completion complete(ParameterDescriptor parameter, String prefix) throws Exception { ShellSession session = (ShellSession)context.getSession(); Completion.Builder builder = Completion.builder(prefix); for (Language lang : session.getContext().getPlugins(Language.class)) { if (lang.isActive()) { if (lang.getRepl() != null) { String name = lang.getName(); if (name.startsWith(prefix)) { builder.add(name.substring(prefix.length()), true); } } } } return builder.build(); } }
@Override public Completion complete(ParameterDescriptor parameter, String prefix) throws Exception { ShellSession session = (ShellSession)context.getSession(); Completion.Builder builder = Completion.builder(prefix); for (Language lang : session.getContext().getPlugins(Language.class)) { if (lang.isActive()) { if (lang.getRepl() != null) { String name = lang.getName(); if (name.startsWith(prefix)) { builder.add(name.substring(prefix.length()), true); } } } } return builder.build(); } }