当前位置: 首页>>代码示例>>Java>>正文


Java Contributor.getRoles方法代码示例

本文整理汇总了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 );
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:26,代码来源:RequireRolesTest.java

示例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 );
        }
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:37,代码来源:DefaultModelProcessor.java

示例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 );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java


注:本文中的org.apache.maven.model.Contributor.getRoles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。