Code-style question about passing return type to the generic method

Viewed 26

I'm trying to pass return type to a generic method but I don't know whether such variant is considered to be ok or not:

RequestUtils.<String>getAttributeFromSession(AttributeName.SUBMISSION_TOKEN, request))

I was thinking about passing it as a parameter, but I feel like method invocation gets more hideous and less straightforward with every new argument passed with it:

RequestUtils.getAttributeFromSession(AttributeName.SUBMISSION_TOKEN, request, String.class))

The first one looks much clearer to me, but I guess it's subjective. Are there any established coding style rules on such a case?

0 Answers
Related