What is a 'Java Category' as referenced in the eclipse 'outline' window
Can anyone tell me why it's useful to use Java categories in Eclipse?
When looking in the 'outline' window, if I click the开发者_StackOverflow社区 menu arrow in the top right and select visible categories I get an option to show certain Java categories, why would I ever want to do this?
Thanks
Well lets not forget that eclipse is an IDE for Java (i am talking only for Java). A Java file could be a human written Java file or it could be a generated file.
If you have some experience with any rational software or JavaCC or Antlr or if you are using MDD (Model Driven Development) then what I am saying will be crystal clear :).
So at times the above mentioned tools generate some skeleton Java files and requiring developer to fill in the gap. Now it would be difficult to find your own method among the auto generated methods and variables (and for big models (MDA) they really generate a large amount of code). So a standard and well behaved generator will generate something like this:
/**
* This is generated method
* @category Generated
*/
public void generatedMethod()
{
// do something fancy
}
/**
* This is not a generated method
* @author James Gosling
*/
public void notAGeneratedMethod()
{
// do something fancy
}
Now from the menu arrow in the top right, you can select the visible categories.
Also in collaborative environment. Where two or more people are working on the same Java class; you can define a @category
as author name or group name, to help developer(s) in quickly navigating.
Hope this will help.
From here:
Categories can be defined in Javadoc comments for types, methods, and fields using the @category tag.
Categories are shown in the Outline and Members views and in the Quick Outline. The view menu allows to select the visible categories.
It looks like it's a way to use the meta-info in your code for sorting.
精彩评论