Actually, I deliberately don't javadoc getters and setters, because you aren't adding any value by doing so - they are what they are... accessor methods. In fact, you would be creating a kind of code bloat by adding javadoc to them.
Up vote 3 down vote favorite share g+ share fb share tw.
My question is should I comment like following: /** * Getter for {@link #auto_key} * @return {@link #auto_key} */ public String getAuto_key() { return auto_key; } /** * Setter for {@link #auto_key} * @param auto_key the {@link #auto_key} to set */ public void setAuto_key(String auto_key) { this. Auto_key = auto_key; } basically I want to ask, using {@link} in comment for getter and setter method is correct? Or should I use normal comment without using {@link}?
And this way is a java standard or not? Java comments link|improve this question edited Apr 6 at 6:39 asked Apr 6 at 6:31pd27204.
Actually, I deliberately don't javadoc getters and setters, because you aren't adding any value by doing so - they are what they are... accessor methods. In fact, you would be creating a kind of code bloat by adding javadoc to them. I only put javadoc on non-getter/setters.
Matter of convention. Varies organization to organization. Previously, we were asked not bother commenting on getters and setters as long as it is obvious what it does.
Which is same as comments without {@link}. Currently, we add {@link} as codes written earlier already has this convention.
If you can refer in your documentation to #auto_key using the {@link}, it means the variable is public accessible (otherwise, the link would not resolve in the javadoc). This means the getter and setter are redundant. I would strongly recommend to make your auto_key field private and keep the getter and setter.
Then adjust the name of the getter and setter to match Java conventions (autoKey, setAutoKey, getAutoKey ). And consider firing PropertyChangeEvents when the autoKey is changed (as a getter/setter combination typically suggests - see JavaBeans ). As for your documentation: it adds nothing new to what the name of the method already suggests.
So I would remove it, or add some extra documentation on what the autoKey exactly does (which is not clear to me from the snippet), whether it may be set to null, ...
You should not put any comments describing getters or setters, unless the method looks like one, but encapsulated different behaviour.
I would suggest generating stand-alone documentation for your set/get methods, while still using {@link}, that is to do both. This way, when the field is accessible people can still get to its documentation. If afterwards it becomes private due to a refactoring, you won't end-up with a bunch of incomplete Javadocs that need to be modified as well.
While documentation for setter/getter methods may seem like code bloat, I would still suggest creating it for a couple of reasons: It gives you a standard location to mention important information, such as setter arguments that should not be null or getters that are woefully inefficient in a particular implementation of an interface. It does not assume that the reader automatically knows what the backing field does. Sure, setLength() may be descriptive enough in some contexts, but what exactly does setLimit() do?
It does not assume that there is a backing field, or that the get/set methods are only doing just that in a particular implementation. It is an unfortunate reality that when refactoring is constrained by compatibility concerns, various artifacts are left behind. E.g.
SetLimit() could delegate to setSizeLimit(), which is something that should be noted. It removes any and all ambiguity. What you consider to be common-sense may not be straight-forward for all people.
Without documentation various assumptions will be made that may or may not be true. For example, in a list implementation, does setLength(0) also set all contained references to null or not? Most importantly, it allows the Javadoc policy to boil-down to a simple "document everything everywhere".
Having a policy with various exceptions, on the other hand, will inevitably lead to laxness and code that is eventually left undocumented.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.