Source code
We can include a source code examples in our documentation via code block:
public static class Fancy extends Object {
private final static String USELESS = "I am useless string";
}
We can link a source code from external file via include plugin. That file can be e.g. compiled against a library to make sure the code is correct before using it in documentation!
package example;
/**
* This is example of a person
*/
public class Person {
private final String firstName;
private final String lastName;
private final String email;
/**
* Creates a new person instance
*/
public Person(String firstName, String lastName, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
/**
* @return first name of this person
*/
public String getFirstName() {
return firstName;
}
/**
* @return last name of this person
*/
public String getLastName() {
return lastName;
}
/**
* @return email of this person
*/
public String getEmail() {
return email;
}
}