lundi 19 février 2018

Can I get a list of method parameters in Java

I'm writing a ton of boilerplate like this. I feel like there has to be a better way. What I'm looking for is getting the new Object[] automatically from the method call. Something like Reflection.getCurrentMethodCall().getArgumentsAsList().toArray(), but I'm not sure what keywords I should be looking for

Thanks!

[ ... 50 identical methods ... ]
                @Override
            public int get_ProxyFactoryMapping(PointerByReference factoryMapping) {
                Function f = Function.getFunction(vTable[48], Function.ALT_CONVENTION);
                return f.invokeInt(new Object[]{getInterface(), factoryMapping});
            }

            @Override
            public int GetPropertyProgrammaticName(int property, PointerByReference name) {
                Function f = Function.getFunction(vTable[49], Function.ALT_CONVENTION);
                return f.invokeInt(new Object[]{getInterface(), property, name});
            }

            @Override
            public int GetPatternProgrammaticName(int pattern, PointerByReference name) {
                Function f = Function.getFunction(vTable[50], Function.ALT_CONVENTION);
                return f.invokeInt(new Object[]{getInterface(), pattern, name});
            }
[ ... 150 identical methods ... ]





Aucun commentaire:

Enregistrer un commentaire