Reputation: 383966
Is there a Java convention to refer to methods, static
and otherwise, any specific one or the whole overload, etc?
e.g.
String.valueOf
- referring to all overloads of static valueOf
String.valueOf(char)
- specific overload, formal parameter name omittable?String.split
- looks like a static method, but actually an instance method
aString.split
is the convention?String().split
?String#split
- I've seen this HTML anchor form too, which I guess is javadoc-influencedIs there an authoritative recommendation on how to clearly refer to these things?
Upvotes: 4
Views: 389
Reputation: 1109512
Depends on the context where you'd like to refer them. I myself tend to use Javadoc-style links everywhere (in Javadocs, my blog, forum posts, etcetera) and prefer to make them clickable as well, although admittely not consistently with method arguments when used outside Javadocs (I am a bit too lazy in this, Eclipse offers autocompletion of @link
tags ;) ). With regard to authoritative recommendations, there's as far as I know only the Javadoc linking recommendation.
Upvotes: 1
Reputation: 370425
Using Class.methodName
to refer to all overloads and Class.methodName(type)
to refer to a specific overload is indeed the convention (as recommended by sun in this style guide for javadocs). However there is no convention to distinguish between static and non-static methods (though aString.split
would make sense).
Upvotes: 7