0

For example, if i have MyObject with fields SomeThing getFieldOne() SomeThing getFieldTwo() whatever, it is obvious, that while javadocking getFieldOne() and getFieldTwo() , i write there an info about the fields of MyObject retuned.

But what to do, if sime fields are not in MyObject directly via getters avaible, but i must call a static adapter like: ObjectContainer.getFieldThree(myObject) ?

The info about the fieldTree is logically related to MyObject, howewer it is no getter method there by design( do not ask me why, i have not designed it , i just want to determine the best way to comment that).

J J
  • 146
  • 2
  • 11
  • Use an [`@see`](http://stackoverflow.com/questions/5011291/usage-of-see-in-javadoc) or `@link`? Or explain exactly what you want to see in the javadoc. – Elliott Frisch May 13 '16 at 12:40
  • Yes good hint with links. I could use those links to ObjectContainer JavaDoc from MyObject Javadoc.
    I want let a user, reading a JavaDoc about MyObject, know, that there exist a fieldTree, what is logically related to MyObject, and to get it, you must call ObjectContainer.getFieldThree(myObject)
    – J J May 13 '16 at 12:51

1 Answers1

0

In a scenario like this, SomeThing does not necessarily have a dependency on ObjectContainer, and thus shouldn't know about the logic or interface of this other class. For this reason, it should not be part of SomeThing's JavaDoc.

I would create a separate JavaDoc for ObjectContainer, explaining the functionality, and in addition to that, create a separate how-to guide on how to use the two classes and other relevant ones in combination, referring to the JavaDoc. This could have a 'cookbook' style, as it is common for many libraries or frameworks, explaining certain use cases and scenarios.

TimoStaudinger
  • 41,396
  • 16
  • 88
  • 94
  • Again: I want let a user, reading a JavaDoc about MyObject, know, that there exist a fieldTree, what is logically related to MyObject, and to get it, you must call ObjectContainer.getFieldThree(myObject) – J J May 13 '16 at 12:52