// Search the current class for requirements
// ----------------------------------------------------------------------
for ( int i = 0; i < fields.length; i++ )
{
JavaField field = fields[i];
DocletTag tag = field.getTagByName( PLEXUS_REQUIREMENT_TAG );
if ( tag == null )
{
continue;
}
Map<String, String> parameters = new HashMap<String, String>( tag.getNamedParameterMap() );
// ----------------------------------------------------------------------
// Role
// ----------------------------------------------------------------------
String requirementClass = field.getType().getJavaClass().getFullyQualifiedName();
boolean isMap = requirementClass.equals( Map.class.getName() ) ||
requirementClass.equals( Collection.class.getName() );
try
{
isMap = isMap || Collection.class.isAssignableFrom( Class.forName( requirementClass ) );
}
catch ( ClassNotFoundException e )
{
// ignore the assignable Collection test, though this should never happen
}
boolean isList = requirementClass.equals( List.class.getName() );
ComponentRequirement cr;
String hint = getParameter( parameters, PLEXUS_ROLE_HINT_PARAMETER );
if ( isMap || isList )
{
cr = new ComponentRequirementList();
String hintList = getParameter( parameters, PLEXUS_ROLE_HINT_LIST_PARAMETER );
if ( hintList != null )
{
String[] hintArr = hintList.split( "," );
( (ComponentRequirementList) cr).setRoleHints( Arrays.asList( hintArr ) );
}
}
else
{
cr = new ComponentRequirement();
cr.setRoleHint( hint );
}
String role = getParameter( parameters, PLEXUS_ROLE_PARAMETER );
if ( role == null )
{
cr.setRole( requirementClass );
}
else
{
cr.setRole( role );
}
String optional = getParameter( parameters, PLEXUS_OPTIONAL_PARAMETER );
cr.setOptional( Boolean.parseBoolean( optional ) );
cr.setFieldName( field.getName() );
if ( isMap || isList )
{
if ( hint != null )
{