vendredi 13 novembre 2015

Grabbing int from object[][] array Java Reflect

I need to grab a int from a object[][], but have no idea how to do it with reflection.

I used this method to grab it from an object[]

    public static Object getInterfaceObject(String clazz, String field, Object obj, int index) {
    try {
        Client client = Boot.client;
        ClassLoader cl = client.classLoader;
        Class<?> c = cl.loadClass(clazz);
        Field f = c.getDeclaredField(field);
        f.setAccessible(true);
        Object arr = f.get(client.getClient());
        return (Object) Array.get(arr, index);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;


}

Since this next one is object[][], I don't know how to go about it.

I want to basically be able to do

getInterfaceObject()[arg1][arg2].otherStuff();





Aucun commentaire:

Enregistrer un commentaire