hiding helper method

?

-

I have a 'helper' method that is called by some methods.
I want to make this method available to the subclasses too and this is
what i have:

protected String concat(String[] text, char delimiter) {
...
}


The problem with this, from my point of view, is that this method will
appear in the generated java documentation.

What is the preferred way to do it to hide it or should it even be
hidden in the first place?
 
C

Chris Smith

- said:
I have a 'helper' method that is called by some methods.
I want to make this method available to the subclasses too and this is
what i have:

protected String concat(String[] text, char delimiter) {
...
}


The problem with this, from my point of view, is that this method will
appear in the generated java documentation.

What is the preferred way to do it to hide it or should it even be
hidden in the first place?

Is this helper method used only within the implementation of a small
piece of your code, or is it more general? If the former, then you can
make it package-access (no access specifier at all). This will prevent
it from appearing in JavaDoc-generated documentation, by default. You
will then need to use it from within that package.

If the helper method is generally useful to all subclasses (instead of a
limited set), then it should be left protected, and fully documented so
that anyone who uses your code and subclasses the class can also use the
functionality there.

In corner cases, if you have a cluster of packages that are part of the
implementation of some module to which that method belongs, you may be
able to move it to a static utility method, and place it in a package
which is not documented. That's a bit of a kludge, though. Use package
access, and try to refactor, and then do that only as a last resort.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

Tor Iver Wilhelmsen

- said:
The problem with this, from my point of view, is that this method will
appear in the generated java documentation.

Not if you use the -public flag to javadoc to limit the scope of the
methods selected for documenting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top