mercredi 11 janvier 2017

java reflexion get parameters name on java 7 [duplicate]

This question already has an answer here:

I want a code compliant java 7.

I want have: ["foo","orderId"]

@Myannotation(value="{orderId}")
public String getOrder(String foo, String orderId){
    //...
}

but I have: ["arg0","arg1"]

Method m = invocation.getMethod();
Parameter[] p = m.getParameters();
for (Parameter parameter : p) {
    System.out.println(parameter.getName());
}

At the end, I want match the word in my annotation with the good parameter (same as in Spring Web REST Service) =>

@RequestMapping(value=("/app/url/user/{user}/city/{city}")
public String getUser(String city, String user){





Aucun commentaire:

Enregistrer un commentaire