dimanche 21 juillet 2019

Its possible to get a param name in a method where the param is the result of a function

When you pass to a function other functions as params there is a way to get the param functions names ?

I tried with reflection but looks like the information do not appears.

public static String LeftFunction(String left) {
  ... Do stuff
  return left;
}

public static String RightFunction(String right) {
  ... Do stuff
  return right;
}

Now if I use a main function like

findRoute(LeftFunction("street 1"), LeftFunction("street 2"), RightFunction("Street 3"));

Is there a way where findRoute function can know if the param 1, 2, 3 .. is called from function left, right, up ....





Aucun commentaire:

Enregistrer un commentaire