I'm not sure what do you exactly mean by 'I want to return Number'? I guess you ask, if it's possible at all to tell in the method signature: 'it will return some super class of Integer' (e.g. Number). Because if you just want to return Number or its subclass, declare the method having Number as return type
Coming back to your question - I'm afraid there is no way of doing that with generics (at least I don't know of any). The reason for this is, as I understand it (and mentioned in the earlier post) that client invoking such method would have to use Object reference anyway to store the returned value. So the only
profit we achieve is some kind of semantic information, which the client could use to dynamically cast the returned object to e.g. Number (using instanceof check). But that's simply not what generics are for in Java. This kind of information may be placed in JavaDoc.
I hope I understood your question correctly and my answer makes sense
P.S. I can think of an example when client would decide what kind of return type he wants, providing it as method argument and being limited to base classes of some given class. The method declaration could look like this:
But, again, it is not possible with the current implementation of generics.