Tabnine Logo
Script.invokeMethod
Code IndexAdd Tabnine to your IDE (free)

How to use
invokeMethod
method
in
groovy.lang.Script

Best Java code snippets using groovy.lang.Script.invokeMethod (Showing top 20 results out of 315)

origin: jenkinsci/jenkins

@Override
public Object invokeMethod(String name, Object args) {
  try {
    return delegate.invokeMethod(name,args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: org.codehaus.groovy/groovy

@Override
public Object invokeMethod(String name, Object args) {
  try {
    if (delegate instanceof GroovyObject) {
      return ((GroovyObject) delegate).invokeMethod(name, args);
    }
    return metaClass.invokeMethod(delegate, name, args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: spockframework/spock

 @Override
 public Object invokeMethod(String name, Object args) {
  try {
   return GroovyRuntimeUtil.invokeMethod($delegate, name, GroovyRuntimeUtil.asArgumentArray(args));
  } catch (MissingMethodException e) {
   return super.invokeMethod(name, args);
  }
 }
}
origin: crashub/crash

@Override
public final Object invokeMethod(String name, Object args) {
 //
 try {
  return super.invokeMethod(name, args);
 }
 catch (MissingMethodException missing) {
  return Helper.invokeMethod(context, name, args, missing);
 }
}
origin: jenkinsci/acceptance-test-harness

  @Override
  public Object invokeMethod(String name, Object args) {
    try {
      return delegateMetaClass.invokeMethod(delegate, name, args);
    } catch (MissingMethodException e) {
      return super.invokeMethod(name,args);
    }
  }
}
origin: freeplane/freeplane

@Override
public Object invokeMethod(String methodName, Object args) {
  try {
    return super.invokeMethod(methodName, args);
  }
  catch (MissingMethodException mme) {
    try {
      return nodeMetaClass.invokeMethod(node, methodName, args);
    }
    catch (MissingMethodException e) {
      throw e;
    }
  }
}
origin: org.jenkins-ci.main/jenkins-core

@Override
public Object invokeMethod(String name, Object args) {
  try {
    return delegate.invokeMethod(name,args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: org.jvnet.hudson.main/hudson-core

@Override
public Object invokeMethod(String name, Object args) {
  try {
    return delegate.invokeMethod(name,args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: com.github.corda.crash/crash.shell

@Override
public final Object invokeMethod(String name, Object args) {
 //
 try {
  return super.invokeMethod(name, args);
 }
 catch (MissingMethodException missing) {
  return Helper.invokeMethod(context, name, args, missing);
 }
}
origin: hudson/hudson-2.x

@Override
public Object invokeMethod(String name, Object args) {
  try {
    return delegate.invokeMethod(name,args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: org.crashub/crash.shell

@Override
public final Object invokeMethod(String name, Object args) {
 //
 try {
  return super.invokeMethod(name, args);
 }
 catch (MissingMethodException missing) {
  return Helper.invokeMethod(context, name, args, missing);
 }
}
origin: stapler/stapler

public Object invokeMethod(String name, Object args) {
  try {
    return delegate.invokeMethod(name,args);
  } catch (MissingMethodException mme) {
    return super.invokeMethod(name, args);
  }
}
origin: disney/groovity

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
  if(request instanceof HttpServletRequest){
    HttpServletRequest hr = (HttpServletRequest) request;
    HttpSession session = hr.getSession(false);
    if(session!=null){
      Object userId = session.getAttribute("userId");
      if(userId != null){
        Groovity groovity = (Groovity) servletContext.getAttribute(GroovityServlet.SERVLET_CONTEXT_GROOVITY_INSTANCE);
        Script factory;
        try {
          factory = groovity.load("/data/factory", new Binding());
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
          throw new ServletException(e);
        }
        Object user = factory.invokeMethod("call", new String[]{"person",userId.toString()});
        if(user!=null && user instanceof Principal){
          request = new AuthenticatedRequestWrapper(hr, (Principal)user);
        }
      }
    }
  }
  chain.doFilter(request, response);
}
origin: com.disney.groovity/groovity-portal

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
  if(request instanceof HttpServletRequest){
    HttpServletRequest hr = (HttpServletRequest) request;
    HttpSession session = hr.getSession(false);
    if(session!=null){
      Object userId = session.getAttribute("userId");
      if(userId != null){
        Groovity groovity = (Groovity) servletContext.getAttribute(GroovityServlet.SERVLET_CONTEXT_GROOVITY_INSTANCE);
        Script factory;
        try {
          factory = groovity.load("/data/factory", new Binding());
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
          throw new ServletException(e);
        }
        Object user = factory.invokeMethod("call", new String[]{"person",userId.toString()});
        if(user!=null && user instanceof Principal){
          request = new AuthenticatedRequestWrapper(hr, (Principal)user);
        }
      }
    }
  }
  chain.doFilter(request, response);
}
origin: com.celum/db-tool

  /**
   * executes the Groovy script
   */
  @Override
  public void execute(DbStep step)
  {
    LOG.info("[GROOVY STEP]:" + step.getName() + " (" + step.getVersion() + ")");
    Reader scriptReader = step.getStepReader();
    Script s = shell.parse(scriptReader);
    s.invokeMethod(GROOVY_DBMAIN, new Object[] {dataSource, variables} );
  }
}
origin: disney/groovity

  @Override
  protected void filteredObject(ModelWalker walker, boolean matched, Object value, ModelVisitor consumer) throws Exception {
    if(matched) {
      if(value instanceof Pointer) {
        Pointer pointer = (Pointer) value;
        boolean known = (boolean) factory.invokeMethod("isKnownType", pointer.getType());
        if(!known) {
          Referent cur = walker.getContextObject(Referent.class);
          if(cur != null) {
            Pointer parent = cur.getPointer();
            //check for lifecycle suffix
            String t = parent.getType();
            int u = t.indexOf("_");
            if(u>0) {
              String nt = pointer.getType().concat(t.substring(u));
              known = (boolean) factory.invokeMethod("isKnownType", nt);
              if(known) {
                pointer = new Pointer(nt,pointer.getId());
              }
            }
          }
        }
        if(known) {
          value = factory.invokeMethod("call", pointer);
        }
      }
    }
    consumer.visitObject(value);
  }
};
origin: fizzed/blaze

@Override
public void execute(String task) throws BlazeException {
  Method method = findTaskMethod(task);
  
  try {
    script.invokeMethod(task, new Object[]{});
  } catch (Exception e) {
    logFirstScriptSource(e);
    if (e instanceof BlazeException) {
      throw (BlazeException)e;
    } else if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    } else {
      throw new BlazeException("Unable to execute task '" + task + "'", e);
    }
  }
}

origin: apache/ofbiz-framework

public static Object runScriptAtLocation(String location, String methodName, Map<String, Object> context) throws GeneralException {
  Script script = InvokerHelper.createScript(getScriptClassFromLocation(location), getBinding(context));
  Object result = null;
  if (UtilValidate.isEmpty(methodName)) {
    result = script.run();
  } else {
    result = script.invokeMethod(methodName, new Object[] { context });
  }
  return result;
}
origin: org.crsh/crsh.shell.core

@Override
public final Object invokeMethod(String name, Object args) {
 //
 try {
  return super.invokeMethod(name, args);
 }
 catch (MissingMethodException e) {
  if (context instanceof InvocationContext) {
   InvocationContext ic = (InvocationContext)context;
   CRaSH crash = (CRaSH)context.getSession().get("crash");
   if (crash != null) {
    ShellCommand cmd;
    try {
     cmd = crash.getCommand(name);
    }
    catch (NoSuchCommandException ce) {
     throw new InvokerInvocationException(ce);
    }
    if (cmd != null) {
     ClassDispatcher dispatcher = new ClassDispatcher(cmd, this);
     return dispatcher.dispatch("", CommandClosure.unwrapArgs(args));
    }
   }
  }
  //
  throw e;
 }
}
origin: apache/ofbiz-framework

  resultObj = script.run();
} else {
  resultObj = script.invokeMethod(modelService.invoke, EMPTY_ARGS);
groovy.langScriptinvokeMethod

Javadoc

Invoke a method (or closure in the binding) defined.

Popular methods of Script

  • run
    A helper method to allow scripts to be run taking command line arguments
  • setBinding
  • getProperty
  • getBinding
  • setProperty
  • getMetaClass
  • setMetaClass
  • evaluate
    A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • getResourceAsStream (ClassLoader)
  • getSystemService (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now