本文整理汇总了Java中org.apache.maven.model.Contributor类的典型用法代码示例。如果您正苦于以下问题:Java Contributor类的具体用法?Java Contributor怎么用?Java Contributor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Contributor类属于org.apache.maven.model包,在下文中一共展示了Contributor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: mergeContributor_Properties
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Properties( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
Properties merged = new Properties();
if ( sourceDominant )
{
merged.putAll( target.getProperties() );
merged.putAll( source.getProperties() );
}
else
{
merged.putAll( source.getProperties() );
merged.putAll( target.getProperties() );
}
target.setProperties( merged );
target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
source.getLocation( "properties" ), sourceDominant ) );
}
示例3: ExtendedArtifact
import org.apache.maven.model.Contributor; //导入依赖的package包/类
/** Constructor.
* @param artifact the artifact.
* @param name name of the artifact.
* @param website website.
* @param organization organization.
* @param scmRevision url of the SCM.
* @param scm SCM.
* @param developers developers.
* @param contributors constributors.
* @param licenses licenses.
*/
public ExtendedArtifact(
Artifact artifact, String name,
String website, Organization organization,
String scmRevision,
Scm scm,
List<? extends Developer> developers,
List<? extends Contributor> contributors,
List<? extends License> licenses) {
this.original = artifact;
this.artifactName = name;
this.developers = developers;
this.contributors = contributors;
this.website = website;
this.organization = organization;
this.scm = scm;
this.scmRevision = scmRevision;
this.licenses = licenses;
}
示例4: updateContributor
import org.apache.maven.model.Contributor; //导入依赖的package包/类
/**
* Method updateContributor
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element )
{
Element root = element;
Counter innerCount = new Counter( counter.getDepth() + 1 );
findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null );
findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null );
findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
示例5: 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 );
}
}
}
示例6: addProjectHavingAnArchitectAsDeveloperAndABusinessEngineerAsContributorToHelper
import org.apache.maven.model.Contributor; //导入依赖的package包/类
private void addProjectHavingAnArchitectAsDeveloperAndABusinessEngineerAsContributorToHelper() throws Exception
{
final MavenProject mavenProject = new MavenProject();
final Developer developer = new Developer();
developer.addRole( "architect" );
mavenProject.addDeveloper( developer );
final Contributor contributor = new Contributor();
contributor.addRole( "business engineer" );
mavenProject.addContributor( contributor );
Mockito.when( helper.evaluate( "${project}" ) ).thenReturn( mavenProject );
}
示例7: contributorsString
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected static String contributorsString(Iterable<? extends Contributor> contributors) {
if (contributors==null) return null;
Set<String> result = new LinkedHashSet<String>();
for (Contributor c: contributors) {
StringBuilder ri = new StringBuilder();
if (isNonEmpty(c.getName())) ri.append(c.getName());
if (isNonEmpty(c.getOrganization()) && !c.getOrganization().startsWith(Organization.class.getName())) {
// ignore org strings of the form [email protected]
// these come from Developer subclass of Contributor which seems to do an Organization.toString() :(
if (ri.length()>0) ri.append(" / ");
ri.append(c.getOrganization());
}
int nameOrgLen = ri.length();
if (isNonEmpty(c.getUrl())) {
if (nameOrgLen>0) ri.append(" (");
ri.append(c.getUrl());
}
if (isNonEmpty(c.getOrganizationUrl())) {
if (ri.length() > nameOrgLen) ri.append(" / ");
else if (nameOrgLen>0) ri.append(" (");
ri.append(c.getOrganizationUrl());
}
if (ri.length() > nameOrgLen) ri.append(")");
result.add(ri.toString().trim());
}
if (result.size()>0) return join(result, "\n");
return null;
}
示例8: mergeContributor
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
mergeContributor_Name( target, source, sourceDominant, context );
mergeContributor_Email( target, source, sourceDominant, context );
mergeContributor_Url( target, source, sourceDominant, context );
mergeContributor_Organization( target, source, sourceDominant, context );
mergeContributor_OrganizationUrl( target, source, sourceDominant, context );
mergeContributor_Timezone( target, source, sourceDominant, context );
mergeContributor_Roles( target, source, sourceDominant, context );
mergeContributor_Properties( target, source, sourceDominant, context );
}
示例9: mergeContributor_Name
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Name( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getName();
if ( src != null )
{
if ( sourceDominant || target.getName() == null )
{
target.setName( src );
target.setLocation( "name", source.getLocation( "name" ) );
}
}
}
示例10: mergeContributor_Email
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Email( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getEmail();
if ( src != null )
{
if ( sourceDominant || target.getEmail() == null )
{
target.setEmail( src );
target.setLocation( "email", source.getLocation( "email" ) );
}
}
}
示例11: mergeContributor_Url
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Url( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getUrl();
if ( src != null )
{
if ( sourceDominant || target.getUrl() == null )
{
target.setUrl( src );
target.setLocation( "url", source.getLocation( "url" ) );
}
}
}
示例12: mergeContributor_Organization
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Organization( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getOrganization();
if ( src != null )
{
if ( sourceDominant || target.getOrganization() == null )
{
target.setOrganization( src );
target.setLocation( "organization", source.getLocation( "organization" ) );
}
}
}
示例13: mergeContributor_OrganizationUrl
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_OrganizationUrl( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getOrganizationUrl();
if ( src != null )
{
if ( sourceDominant || target.getOrganizationUrl() == null )
{
target.setOrganizationUrl( src );
target.setLocation( "organizationUrl", source.getLocation( "organizationUrl" ) );
}
}
}
示例14: mergeContributor_Timezone
import org.apache.maven.model.Contributor; //导入依赖的package包/类
protected void mergeContributor_Timezone( Contributor target, Contributor source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getTimezone();
if ( src != null )
{
if ( sourceDominant || target.getTimezone() == null )
{
target.setTimezone( src );
target.setLocation( "timezone", source.getLocation( "timezone" ) );
}
}
}
示例15: 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 );
}
}