use of org.apache.maven.doxia.document.DocumentAuthor in project maven-plugins by apache.
the class DocumentModelBuilder method getAuthors.
/**
* Wrap the list of project {@link Developer} to a list of {@link DocumentAuthor}.
*
* @param project the MavenProject to extract the authors from.
* @return a list of DocumentAuthors from the project developers.
* Returns null if project is null or contains no developers.
*/
private static List<DocumentAuthor> getAuthors(MavenProject project) {
if (project == null || project.getDevelopers() == null) {
return null;
}
final List<DocumentAuthor> ret = new ArrayList<DocumentAuthor>(4);
for (Object o : project.getDevelopers()) {
final Developer developer = (Developer) o;
final DocumentAuthor author = new DocumentAuthor();
author.setName(developer.getName());
author.setEmail(developer.getEmail());
author.setCompanyName(developer.getOrganization());
StringBuilder roles = null;
for (final String role : developer.getRoles()) {
if (roles == null) {
roles = new StringBuilder(32);
} else {
roles.append(',').append(' ');
}
roles.append(role);
}
if (roles != null) {
author.setPosition(roles.toString());
}
ret.add(author);
}
return ret;
}
Aggregations