com.ibm.as400.access.jdbcClient

Class ReflectionUtil



  • public class ReflectionUtil
    extends Object
    • Constructor Detail

      • ReflectionUtil

        public ReflectionUtil()
    • Method Detail

      • callMethod_O

        public static Object callMethod_O(Object o,
                          String methodName)
                                   throws Exception
        call a method which returns an Object Examples Object o = callMethod_O(ds, ... ");
        Throws:
        Exception
      • callMethod_O

        public static Object callMethod_O(Object o,
                          String methodName,
                          int i)
                                   throws Exception
        call a method which returns an Object Examples Object o = callMethod_O(ds, ... ");
        Throws:
        Exception
      • callMethod_O

        public static Object callMethod_O(Object o,
                          String methodName,
                          Class c)
                                   throws Exception
        call a method which returns an Object Examples Object o = callMethod_O(ds, ... ");
        Throws:
        Exception
      • callMethod_OS

        public static Object callMethod_OS(Object o,
                           String methodName,
                           String s)
                                    throws Exception
        call a method which returns an Object Examples Object o = callMethod_O(ds, ... ");
        Throws:
        Exception
      • callMethod_O

        public static Object callMethod_O(Object o,
                          String methodName,
                          long i,
                          long j)
                                   throws Exception
        call a method which returns an Object Examples Object o = callMethod_O(ds, ... ");
        Throws:
        Exception
      • callMethod_S

        public static String callMethod_S(Object o,
                          String methodName)
                                   throws Exception
        call a method which returns a string Examples String property = callMethod_S(ds, "getTranslateHex");
        Throws:
        Exception
      • callMethod_S

        public static String callMethod_S(Object o,
                          String methodName,
                          int i)
                                   throws Exception
        call a method which returns a string Examples String property = callMethod_S(ds, "getTranslateHex");
        Throws:
        Exception
      • callMethod_S

        public static String callMethod_S(Object o,
                          String methodName,
                          long l,
                          int j)
                                   throws Exception
        call a method which returns a string Examples String property = JDReflectionUtil.callMethod_S(outNClob, "getSubString", 1, outLength);
        Throws:
        Exception
      • callMethod_I

        public static int callMethod_I(Object o,
                       String methodName)
                                throws Exception
        call a method which returns an integer Examples int value = callMethod_I(ds, "getMaximumPrecision");
        Throws:
        Exception
      • callMethod_I

        public static int callMethod_I(Object o,
                       String methodName,
                       int parm)
                                throws Exception
        call a method which returns an integer Examples int value = callMethod_I(ds, "getMaximumPrecision");
        Throws:
        Exception
      • callMethod_L

        public static long callMethod_L(Object o,
                        String methodName)
                                 throws Exception
        call a method which returns an long Examples int value = callMethod_L(ds, "length");
        Throws:
        Exception
      • callMethod_B

        public static boolean callMethod_B(Object o,
                           String methodName)
                                    throws Exception
        call a method which returns a boolean Examples boolean value = callMethod_B(ds, "getReturnExtendedMetaData");
        Throws:
        Exception
      • callMethod_B

        public static boolean callMethod_B(Object o,
                           String methodName,
                           int i)
                                    throws Exception
        call a method which returns a boolean Examples boolean value = callMethod_B(connection, "isValid", 60)
        Throws:
        Exception
      • callMethod_B

        public static boolean callMethod_B(Object o,
                           String methodName,
                           Class x)
                                    throws Exception
        call a method which returns a boolean Examples boolean value = callMethod_B(ds, "isWrapperFor", Class.forName("java.lang.String");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        Class[] argTypes,
                        Object[] args)
                                 throws Exception
        call a method which returns nothing. The parameter types and values are passed. Examples callMethod_V(ds, "setReturnExtendedMetaData", argTypes, args);
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName)
                                 throws Exception
        call a method which returns nothing and is passed nothing Examples callMethod_V(ds, "close");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        int parm1)
                                 throws Exception
        call a method which returns nothing, but is passed an int Examples callMethod_V(ds, "setMaximumPrecision", 34);
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        int parm1,
                        String parm2)
                                 throws Exception
        call a method which returns nothing, but is passed an int and a string String Examples callMethod_V(ps, "setNString", 1, "character");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        String parm1,
                        String parm2)
                                 throws Exception
        call a method which returns nothing, but is passed an string and a string String Examples callMethod_V(ps, "setNString", "col1", "character");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        boolean parm1)
                                 throws Exception
        call a method which returns nothing, but is passed an boolean Examples callMethod_V(ds, "setReturnExtendedMetaData", true);
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        byte[] parm1)
                                 throws Exception
        call a method which returns nothing, but is passed a byte array Examples callMethod_V(ds, "setTranslateHex", "character");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        int i,
                        Object parm2)
                                 throws Exception
        call a method which returns nothing, but is passed an integer and object The method to be called is dynamically resolved Examples callMethod_V(ps, "psSetNClob", 1, "character");
        Throws:
        Exception
      • addInterfacesToHashtable

        public static void addInterfacesToHashtable(Hashtable interfacesHashtable,
                                    Class checkClass)
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        long l,
                        Object parm2)
                                 throws Exception
        call a method which returns nothing, but is passed a long and object The method to be called is dynamically resolved Examples callMethod_V(nclob, "setString", 1, "character");
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        int parameterIndex,
                        InputStream inputStream,
                        long length)
                                 throws Exception
        call a method which returns nothing, but is passed int, InputStream, long Examples JDReflectionUtil.callMethod_V(ps, "setBlob", 1, is, (long) 4);
        Throws:
        Exception
      • callMethod_V_IS

        public static void callMethod_V_IS(Object o,
                           String methodName,
                           String parameterName,
                           InputStream inputStream,
                           long length)
                                    throws Exception
        call a method which returns nothing, but is passed String, InputStream, long Examples JDReflectionUtil.callMethod_V(ps, "setBlob", "col1", is, (long) 4);
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        int parameterIndex,
                        Reader reader,
                        long length)
                                 throws Exception
        call a method which returns nothing, but is passed int, Reader, long Examples JDReflectionUtil.callMethod_V(ps, "setClob", 1, r, (long) 4);
        Throws:
        Exception
      • callMethod_V

        public static void callMethod_V(Object o,
                        String methodName,
                        String parameterName,
                        Reader reader,
                        long length)
                                 throws Exception
        call a method which returns nothing, but is passed String, Reader, long Examples JDReflectionUtil.callMethod_V(ps, "setClob", "C1", r, (long) 4);
        Throws:
        Exception
      • callStaticMethod_O

        public static Object callStaticMethod_O(String classname,
                                String methodName)
                                         throws Exception
        call a static method whihc returns an object. Examples JDReflectionUtil.callStaticMethod_O("", "newInstance");
        Throws:
        Exception
      • callStaticMethod_I

        public static int callStaticMethod_I(String classname,
                             String methodName)
                                      throws Exception
        call a static method whihc returns an int. Examples JDReflectionUtil.callStaticMethod_O("", "newInstance");
        Throws:
        Exception
      • createObject

        public static Object createObject(String classname)
                                   throws Exception
        create an object using reflection Examples JDReflectionUtil.createObject("com.ibm.db2.jcc.DB2XADataSource") callMethod_V(ds, "setTranslateHex", "character");
        Throws:
        Exception
      • createObject

        public static Object createObject(String classname,
                          byte[] arg)
                                   throws Exception
        create an object using reflection Examples JDReflectionUtil.createObject("com.ibm.db2.app.DB2RowId", testArray)
        Throws:
        Exception
      • createObject

        public static Object createObject(String classname,
                          String parameterClass,
                          Object arg)
                                   throws Exception
        create an object using reflection Examples JDReflectionUtil.createObject("javax.xml.transform.stax.StAXSource", "javax.xml.stream.XMLStreamReader", xmlStreamReader);
        Throws:
        Exception
      • getField_I

        public static int getField_I(Object o,
                     String fieldName)
                              throws Exception
        get an integer field Examples int value = getField_I(ds, "getMaximumPrecision");
        Throws:
        Exception