Package java.lang.reflect

Examples of java.lang.reflect.Method.invoke()


public class _ObjectStreamClass {
  public static ObjectStreamClass lookupAny(Class<?> cl) {
    try {
      Method m = ObjectStreamClass.class.getDeclaredMethod("lookup",new Class[] { Class.class, Boolean.TYPE }); //$NON-NLS-1$
      m.setAccessible(true);
      return (ObjectStreamClass) m.invoke(null, new Object[] { cl,Boolean.valueOf(true) });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
View Full Code Here


      if (prop.advanced()) {
        throw new TeiidRuntimeException("TranslatorProperty annotation should not both be advanced and required " + method); //$NON-NLS-1$
      }
    } else if (getter != null) {
      try {
        defaultValue = getter.invoke(instance, (Object[])null);
      } catch (Exception e) {
        //no simple default value
      }
    }
    if (type.isEnum()) {
View Full Code Here

      final ClientService clientService = this.csr.getClientService(serviceStruct.targetClass.getName());     
      loggingContext = clientService.getLoggingContext();
      Method m = clientService.getReflectionHelper().findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
      Object methodResult;
      try {
        methodResult = m.invoke(clientService.getInstance(), serviceStruct.args);
      } catch (InvocationTargetException e) {
        throw e.getCause();
      }
      if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
        ResultsFuture<Object> future = (ResultsFuture<Object>) methodResult;
View Full Code Here

            parameters[i] = arg.getValue();
        }
        Method method = clazz.getMethod(methodName, parameterTypes);
        returnClass = method.getReturnType();
        try {
            Object obj = method.invoke(object, parameters);
            if (assignment) {
                player.assign(assignVariable, obj);
            }
            return obj;
        } catch (IllegalArgumentException e) {
View Full Code Here

      String propertyName = getPropertyName(method);
      String value = caseInsensitivProps.remove(propertyName);
     
      if (value != null) {
        Method setterMethod = getSetter(ef.getClass(), method);
        setterMethod.invoke(ef, convert(value, method.getReturnType()));
      } else if (tp.required()) {
        throw new DeploymentException(RuntimePlugin.Util.getString("required_property_not_exists", tp.display())); //$NON-NLS-1$
      }
    }
    caseInsensitivProps.remove(Translator.EXECUTION_FACTORY_CLASS);
View Full Code Here

    ServiceInvocationStruct serviceStruct = (ServiceInvocationStruct)me.getMessage();

    try {
      Method m = this.clientProxy.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
      try {
        m.invoke(this, serviceStruct.args);
      } catch (InvocationTargetException e) {
        throw e.getCause();
      }   
    } catch (Throwable e) {
      terminate(e);
View Full Code Here

      Method m = this.serverProxy.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
      try {
        // since the postgres protocol can produce more than single response
        // objects to a request, all the methods are designed to return void.
        // and relies on client interface to build the responses.
        m.invoke(this.server, serviceStruct.args);
      } catch (InvocationTargetException e) {
        throw e.getCause();
      }   
    } catch (Throwable e) {
      this.client.errorOccurred(e);
View Full Code Here

           
            // get static logger method & use to get our logger
            Class[] args = { String.class };
            Method getLogger = log4jLogger.getMethod("getLogger", args);
            Object[] invokeArgs = {clazz};
            logger = getLogger.invoke(null, invokeArgs);
           
            // get the logger's methods and store them
            Class[] plainArgs = {Object.class};
            Class[] throwableArgs = {Object.class,Throwable.class};
            logMethods[Level.FATAL_INT][0] = log4jLogger.getMethod("fatal", plainArgs);
View Full Code Here

        // retrieve the correct method
        Method method = logMethods[level.getLevel()][pos];
       
        // and invoke the method
        try {
            method.invoke(logger, args);
        }
        catch (Exception ex) { // there's a few, we don't care what they are
            ourLog(Level.ERROR, "Failed to invoke log4j logging method", ex);
            ourLog(level, message, t);
            useLog4j = false;
View Full Code Here

    for (int i = 0; i < methods.length; i++) {
      String name = methods[i].getDisplayName();
      Method meth = methods[i].getMethod();
      if (name.equals("globalInfo")) {
        String globalInfo = (String)(meth.invoke(classifier, args));
        result += globalInfo;
        break;
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.