本文整理汇总了Java中org.apache.maven.model.Contributor.getRoles方法的典型用法代码示例。如果您正苦于以下问题:Java Contributor.getRoles方法的具体用法?Java Contributor.getRoles怎么用?Java Contributor.getRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Contributor
的用法示例。
在下文中一共展示了Contributor.getRoles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetRolesFromMaven
import org.apache.maven.model.Contributor; //导入方法依赖的package包/类
/**
* Test of getRolesFromMaven method, of class AbstractRequireRoles.
*/
@Test
public void testGetRolesFromMaven()
{
HashSet<String> expResult = new HashSet<String>( Arrays.asList(
"quality manager", "product owner", "business engineer" ) );
final Contributor singleHero = new Contributor();
singleHero.addRole( "quality manager" );
singleHero.addRole( "business engineer" );
singleHero.addRole( "product owner" );
List<Contributor> listFromMaven = Arrays.asList( singleHero );
final HashSet<String> result = new HashSet<String>();
for ( final Contributor contributor : listFromMaven )
{
@SuppressWarnings( "unchecked" )
List<String> roles = contributor.getRoles();
for ( String role : roles )
{
result.add( role );
}
}
assertEquals( expResult, result );
}
示例2: visitContributor
import org.apache.maven.model.Contributor; //导入方法依赖的package包/类
private void visitContributor( ModelVisitor visitor, Contributor contributor )
{
List<String> roles = contributor.getRoles();
if ( roles != null )
{
ListIterator<String> roleIterator = roles.listIterator();
while ( roleIterator.hasNext() )
{
String role = roleIterator.next();
visitor.visitContributorRole( role );
role = visitor.replaceContributorRole( role );
if ( role == null )
roleIterator.remove();
else
roleIterator.set( role );
}
}
Properties properties = contributor.getProperties();
if ( properties != null )
{
Iterator<Entry<Object, Object>> propertyIterator = properties.entrySet().iterator();
while ( propertyIterator.hasNext() )
{
Entry<Object, Object> property = propertyIterator.next();
String propertyKey = (String) property.getKey();
String propertyValue = (String) property.getKey();
visitor.visitContributorProperty( propertyKey, propertyValue );
propertyValue = visitor.replaceContributorProperty( propertyKey, propertyValue );
if ( propertyValue == null )
propertyIterator.remove();
else
property.setValue( propertyValue );
}
}
}
示例3: mergeContributor_Roles
import org.apache.maven.model.Contributor; //导入方法依赖的package包/类
protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
List<String> src = source.getRoles();
if ( !src.isEmpty() )
{
List<String> tgt = target.getRoles();
List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
merged.addAll( tgt );
merged.addAll( src );
target.setRoles( merged );
}
}