// 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 );
}
cr.setFieldName( field.getName() );
if ( isMap || isList )
{
if ( hint != null )
{
/*
log.warn( "Field: '" + field.getName() + "': A role hint cannot be specified if the " +
"field is a java.util.Map or a java.util.List" );
*/
continue;
}
if ( role == null )
{
/*
log.warn( "Field: '" + field.getName() + "': A java.util.Map or java.util.List " +
"requirement has to specify a '" + PLEXUS_ROLE_PARAMETER + "' parameter on " + "the @" +
PLEXUS_REQUIREMENT_TAG + " tag so Plexus can know which components to " +
"put in the map or list." );
*/
continue;
}
JavaClass roleClass = classCache.getClassByName( role );
if ( role.indexOf( '.' ) == -1 && StringUtils.isEmpty( getPackage( roleClass ) ) )
{
role = getPackage( javaClass ) + "." + roleClass.getName();
}
cr.setRole( role );
findExtraParameters( PLEXUS_REQUIREMENT_TAG, parameters );
}
// ----------------------------------------------------------------------