Author: vsiveton Date: Mon Jun 1 11:18:45 2009 New Revision: 780616 URL: http://svn.apache.org/viewvc?rev=780616&view=rev Log: o added name field to set a full name o code segment to return all author names and a full name
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/mdo/document.mdo Modified: maven/doxia/doxia/trunk/doxia-core/src/main/mdo/document.mdo URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/mdo/document.mdo?rev=780616&r1=780615&r2=780616&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-core/src/main/mdo/document.mdo (original) +++ maven/doxia/doxia/trunk/doxia-core/src/main/mdo/document.mdo Mon Jun 1 11:18:45 2009 @@ -412,6 +412,39 @@ return ret; } + + /** + * @return {...@link #getAuthor()} if the unique author name is defined. Otherwise, return all authors full names + * comma separated. + * @see #getAuthor() + * @see #getAuthors() + * @since 1.1.1 + */ + public String getAllAuthorNames() + { + StringBuffer sb = new StringBuffer(); + if ( getAuthor() != null && getAuthor().trim().length() > 0 ) + { + return getAuthor().trim(); + } + + if ( getAuthors() != null ) + { + for ( java.util.Iterator it = getAuthors().iterator(); it.hasNext(); ) + { + DocumentAuthor author = (DocumentAuthor) it.next(); + + sb.append( author.getFullName().trim() ); + + if ( it.hasNext() ) + { + sb.append( ", " ); + } + } + } + + return sb.toString(); + } ]]> </code> </codeSegment> @@ -442,6 +475,16 @@ <identifier>true</identifier> </field> <field> + <name>name</name> + <description><![CDATA[ + The full name of the author, usually as a String of "firstName lastName". + @since 1.1.1 + ]]></description> + <version>1.0.1+</version> + <type>String</type> + <identifier>true</identifier> + </field> + <field> <name>initials</name> <description><![CDATA[ The initials of the author. @@ -550,6 +593,33 @@ <identifier>true</identifier> </field> </fields> + <codeSegments> + <codeSegment> + <code> + <![CDATA[ + /** + * Get the full name of the author. + * + * @return <code>name</code> if defined, <code>firsName lastName</code> otherwise. + * @see #getName() + * @see #getFirstName() + * @see #getLastName() + * @since 1.1.1 + */ + public String getFullName() + { + if ( getName() != null && getName().trim().length() > 0 ) + { + return getName().trim(); + } + + return ( getFirstName() != null ? getFirstName().trim() : "null" ) + " " + + ( getLastName() != null ? getLastName().trim() : "null" ); + } + ]]> + </code> + </codeSegment> + </codeSegments> </class> <class>