Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
 
 
 /*
  * Created on : 04.2003
  * Created by : s3595
  */
 package at.spardat.xma.boot.util;
 
 

Deprecated:
because not used any more
Author(s):
CGS
Version:
$Id: Reflectives.java 2084 2007-11-27 14:53:31Z s3460 $
 
 public class Reflectives {
 
     private boolean accessible;
     private static Object zero[] = new Object[0];

    
Create a new Reflect instance.

Deprecated:
 
     public Reflectives() {}

    
Create a new Reflect instance.

Deprecated:
Parameters:
accessible whether to bypass access permissions
 
     public Reflectives(boolean accessible) {
         this. = accessible;
     }

    
Invoke a zero-parameter static method by name.

Deprecated:
 
     public Object invokeStatic(String classNameString method) {
         return invokeStatic(classNamemethod);
     }

    
Invoke the static method using the specified parameters.

Deprecated:
 
     public Object invokeStatic(String classNameString methodObject args[]) {
         try {
             Class c = Class.forName(classNametrueReflectives.class.getClassLoader());
 
             Method m = getMethod(cmethodargs);
             if (m.isAccessible() != )
                 m.setAccessible();
 
             return m.invoke(nullargs);
         }
         catch (Exception ex) { // eat
             Logger.getLogger("bootrt.bootRuntime").log(.,"",ex);
             return null;
         }
     }

    
Invoke a zero-parameter method by name on the specified object.

Deprecated:
 
     public Object invoke(Object objectString method)
       throws Exception {
         return invoke(objectmethod);
     }

    
Invoke a method by name with the specified parameters.

Deprecated:
Returns:
the result of the method
 
     public Object invoke(Object objectString methodObject args[])
       throws Exception {
         try {
             Method m = getMethod(object.getClass(), methodargs);
             if (m.isAccessible() != )
                 m.setAccessible();
            return m.invoke(objectargs);
        }
        catch (Exception ex) {
            ex.printStackTrace();
            throw ex ;
        }
    }

    
Return the Method matching the specified name and number of arguments.

Deprecated:
    public Method getMethod(Class typeString methodObject args[])
      throws Exception {
        try {
            for (Class c = typec != nullc = c.getSuperclass()) {
                Method methods[] = c.getMethods();
                for (int i=0; i < methods.lengthi++) {
                    if (methods[i].getName().equals(method)) {
                        Class parameters[] = methods[i].getParameterTypes();
                        if (parameters.length == args.length)
                            return methods[i];
                    }
                }
            }
        }
        catch (Exception ex) {
          ex.printStackTrace();
          throw ex;
        }
        return null;
    }
New to GrepCode? Check out our FAQ X