When you need to extract a specific method body use the plugin Consider the file below You can specify a method name to extract its full definition or display only its body If is specified signature will be omitted include java ** * Top level conceptual description of a @link CustomDomain problem * <p> * To avoid <b>copy & paste< b> of the content consider to re use information * class HelloWorld ** * Each year we hire students from different universities to increase * @link Diversity * private int numberOfStudents ** * Conceptual description of a <i>Domain< i> problem * <p> * It will work only if you put high level description here and * <b>not< b> implementation details * * @param p1 important parameter of something * @param p2 sample <i>offset< i> according to the rules of the universe * @return name of the <b>best< b> sample * public String sampleMethod String p1 int p2 validate process p2 important comment notifyAll p1 very important return bestSample public void sampleMethod Map<String Integer> p1 int p2 boolean isActive overloaded method ** * @param trader trader that performs action * @param transaction transaction to perform action on * public void importantAction Trader trader Transaction transaction TODO important public Data createData create data include java HelloWorld java entry sampleMethod bodyOnly true bodyOnly validate process p2 important comment notifyAll p1 very important return bestSample
Similar to how you specify comments type for a regular file you can specify option for commentsType include java include java HelloWorld java entry sampleMethod bodyOnly true commentsType inline validate process p2 important comment notifyAll p1 very important return bestSample
Use property to specify extracted code snippet title title include java HelloWorld java entry sampleMethod bodyOnly true title my snippet validate process p2 important comment notifyAll p1 very important return bestSample
Use to make a code snippet linkable Hover mouse over title to see a clickable anchor anchorId include java HelloWorld java entry sampleMethod bodyOnly true title my snippet anchorId my java snippet validate process p2 important comment notifyAll p1 very important return bestSample
You can also specify a method name and extract only its signature If is specified body will be omitted Pass to have a provided line in between entries as a separator include java HelloWorld java entry sampleMethod signatureOnly true signatureOnly public String sampleMethod String p1 int p2 public void sampleMethod Map<String Integer> p1 int p2 boolean isActive entrySeparator <separator> include java HelloWorld java entry sampleMethod signatureOnly true entrySeparator public String sampleMethod String p1 int p2 public void sampleMethod Map<String Integer> p1 int p2 boolean isActive
Specify types inside brackets to select an overloaded versions of your methods Types should appear as they are in the file i e if you use the short version of a type you need to use the short version inside the plugin Note Generic types are erased and spaces after commas are optional include java HelloWorld java entry sampleMethod Map int boolean public void sampleMethod Map<String Integer> p1 int p2 boolean isActive overloaded method
To extract or body use Use to only display body of your type class interface enum include java MyEnum java entry MyEnum enum MyEnum ** * description of <b>entry one< b> * ENTRY_ONE ** * description of entry two * <ul> * <li>item one< li> * <li>item two< li> * < ul> * ENTRY_TWO ** * Don t use instead use ENTRY_TWO * @Deprecated ENTRY_THREE bodyOnly include java MyEnum java entry MyEnum bodyOnly true ** * description of <b>entry one< b> * ENTRY_ONE ** * description of entry two * <ul> * <li>item one< li> * <li>item two< li> * < ul> * ENTRY_TWO ** * Don t use instead use ENTRY_TWO * @Deprecated ENTRY_THREE
To display multiple methods at once pass a list to parameter This will render List important methods signatures at one place by passing This will render entry include java HelloWorld java entry createData importantAction public Data createData create data public void importantAction Trader trader Transaction transaction TODO important signatureOnly true include java HelloWorld java entry createData importantAction signatureOnly true public Data createData public void importantAction Trader trader Transaction transaction
To list of the overloads of a method specify method name using the parameter entry include java HelloWorld java entry sampleMethod signatureOnly true public String sampleMethod String p1 int p2 public void sampleMethod Map<String Integer> p1 int p2 boolean isActive
Pass multiple entries and to extract example of usage from unit tests Pass to have a provided line in between entries as a separator bodyOnly public class HelloWorldTest @Test public void exampleOfA a action @Test public void exampleOfB b action include java HelloWorldTest java entry exampleOfA exampleOfB bodyOnly true title example of actions a action b action entrySeparator <separator> include java HelloWorldTest java entry exampleOfA exampleOfB entrySeparator bodyOnly true title example of actions a action b action