You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to figure out how to get the Java Class of a generated param. I have tried using getting the AbstractJType type() from the param and playing around with the API but cant seem to figure out how to get the Class value.
For example given the following params I would like to extract the type. I am also trying to determine if a param is a List or not, but I cant seem to figure that out either. I ave tried isArray on the type, as well a using a ref to a List.class and checking isAssignable but I think its checking the actual jcode type. I am trying to refrain from checking if the param.type().name().startsWith("List") or use regex to extract the type, but at this point thats all I can come up with
List - List
CustomObject - CustomObject
is List of type list? - true
is CustomObject of type list? - false
Thanks!
The text was updated successfully, but these errors were encountered:
I think the method should be added in the abstractJType :
boolean AbstractJType::isInstanceOf(Class <?> clazz) {return owner().ref(clazz).isAssignableFrom(this);} . This would allow to call if(firstParam.type().isInstanceOf(List.class)){…}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am trying to figure out how to get the Java Class of a generated param. I have tried using getting the AbstractJType type() from the param and playing around with the API but cant seem to figure out how to get the Class value.
For example given the following params I would like to extract the type. I am also trying to determine if a param is a List or not, but I cant seem to figure that out either. I ave tried isArray on the type, as well a using a ref to a List.class and checking isAssignable but I think its checking the actual jcode type. I am trying to refrain from checking if the param.type().name().startsWith("List") or use regex to extract the type, but at this point thats all I can come up with
List - List
CustomObject - CustomObject
is List of type list? - true
is CustomObject of type list? - false
Thanks!
The text was updated successfully, but these errors were encountered: