mercredi 29 septembre 2021

Java Reflection Question about String... parameter for method

public static Client initClient(boolean paramBoolean, String... paramVarArgs) {

How would I reflect this method? I tried the follow -

final Method runClientMethod = clientClass.getMethod("initClient", Boolean.class, String.class);
final Method runClientMethod = clientClass.getMethod("initClient", Boolean.class, String[].class);

I am not sure how to properly declare String... paramVarArgs in reflection. If your getMethod isn't identical, the method cannot be found.. my above attempt throws a MethodNotFound exception





Aucun commentaire:

Enregistrer un commentaire