mardi 23 octobre 2018

Groovy Generics with Class as a Argument

I am trying to create a helper method in Groovy for my spock test and getting compiler error. Listed below is the code

ResponseEntity<PagedResources<Object>> createResponseEntityPagedResources(String jsonString, Class clazz){
    ResponseEntity<PagedResources<clazz>> responseEntity = new ResponseEntity<>(new PagedResources<clazz>(jsonString, new PagedResources.PageMetadata(1, 0, 0)), HttpStatus.OK)
    return responseEntity
}

Error is

Can not resolve symbol clazz





Aucun commentaire:

Enregistrer un commentaire