Package java.lang.reflect

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


    try{
      Method getString = listener_class.getMethod( "getString", new Class[0]);
     
      if ( getString != null ){
       
        String s = (String)getString.invoke( listener, new Object[0] );
       
        res += " (" + s + ")";
      }
    }catch( Throwable e ){
     
View Full Code Here


          Method method = enhancerClass.getMethod("getFileIcon",
              new Class[] {
                File.class,
                boolean.class
              });
          image = (Image) method.invoke(null, new Object[] {
            file,
            bBig
          });
          if (image != null) {
            if (!bBig)
View Full Code Here

          Method method = enhancerClass.getMethod("getFileIcon",
              new Class[] {
                String.class,
                int.class
              });
          image = (Image) method.invoke(null, new Object[] {
            file.getAbsolutePath(),
            (int) (bBig ? 128 : 16)
          });
          if (image != null) {
            if (!bBig)
View Full Code Here

        if (sfClass != null && file != null) {
          Method method = sfClass.getMethod("getShellFolder", new Class[] {
            File.class
          });
          if (method != null) {
            Object sfInstance = method.invoke(null, new Object[] {
              file
            });
 
            if (sfInstance != null) {
              method = sfClass.getMethod("getIcon", new Class[] {
View Full Code Here

            if (sfInstance != null) {
              method = sfClass.getMethod("getIcon", new Class[] {
                Boolean.TYPE
              });
              if (method != null) {
                awtImage = (java.awt.Image) method.invoke(sfInstance,
                    new Object[] {
                      new Boolean(bBig)
                    });
              }
            }
View Full Code Here

        try {

          Class<?> ehancerClass = Class.forName("org.gudy.azureus2.ui.swt.osx.CocoaUIEnhancer");

          Method mGetInstance = ehancerClass.getMethod("getInstance", new Class[0]);
          Object claObj = mGetInstance.invoke(null, new Object[0] );

          Method mHookAppMenu = claObj.getClass().getMethod("hookApplicationMenu", new Class[] {});
          if (mHookAppMenu != null) {
            mHookAppMenu.invoke(claObj, new Object[0]);
          }
View Full Code Here

          Method mGetInstance = ehancerClass.getMethod("getInstance", new Class[0]);
          Object claObj = mGetInstance.invoke(null, new Object[0] );

          Method mHookAppMenu = claObj.getClass().getMethod("hookApplicationMenu", new Class[] {});
          if (mHookAppMenu != null) {
            mHookAppMenu.invoke(claObj, new Object[0]);
          }

          Method mHookDocOpen = claObj.getClass().getMethod("hookDocumentOpen", new Class[] {});
          if (mHookDocOpen != null) {
            mHookDocOpen.invoke(claObj, new Object[0]);
View Full Code Here

            mHookAppMenu.invoke(claObj, new Object[0]);
          }

          Method mHookDocOpen = claObj.getClass().getMethod("hookDocumentOpen", new Class[] {});
          if (mHookDocOpen != null) {
            mHookDocOpen.invoke(claObj, new Object[0]);
          }
         
        } catch (Throwable e) {

          Debug.printStackTrace(e);
View Full Code Here

    private static void initializeSigar() {
        try {
            Object sigar = Class.forName("org.hyperic.sigar.Sigar").newInstance();
            Method proxyMtd = Class.forName("org.hyperic.sigar.SigarProxyCache").getMethod("newInstance", sigar.getClass(), int.class);
            // Update caches every 2 seconds.
            sigarInstance = proxyMtd.invoke(null, sigar, 2000);
            sigarCpuPercMtd = sigarInstance.getClass().getMethod("getCpuPerc");
            sigarCpuCombinedMtd = sigarCpuPercMtd.getReturnType().getMethod("getCombined");
            sigarIoWaitMtd = sigarCpuPercMtd.getReturnType().getMethod("getWait");
        } catch (Exception e) {
            LogFactory.getLog(SystemUtils.class).error("Failed to initilize Hyperic Sigar", e);
View Full Code Here

    }

    Object result;
    Method method = invokeMethod.method;
    try {
      result = method.invoke(target, invokeMethod.args);
    } catch (Exception ex) {
      throw new RuntimeException("Error invoking method: " + method.getDeclaringClass().getName() + "." + method.getName(), ex);
    }

    byte responseID = invokeMethod.responseID;
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.