本文整理汇总了Java中org.apache.maven.artifact.versioning.ArtifactVersion.getMajorVersion方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactVersion.getMajorVersion方法的具体用法?Java ArtifactVersion.getMajorVersion怎么用?Java ArtifactVersion.getMajorVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.versioning.ArtifactVersion
的用法示例。
在下文中一共展示了ArtifactVersion.getMajorVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isReleased
import org.apache.maven.artifact.versioning.ArtifactVersion; //导入方法依赖的package包/类
private static boolean isReleased(ArtifactVersion version) {
String qualifier = version.getQualifier();
if (version.getMajorVersion() <= 0) {
return false;
} else if (Strings.isNullOrEmpty(qualifier)) {
return true;
} else if ("final".equalsIgnoreCase(qualifier.toLowerCase(Locale.US))) {
return true;
}
return false;
}
示例2: calculateVersionTagNamePart
import org.apache.maven.artifact.versioning.ArtifactVersion; //导入方法依赖的package包/类
public static String calculateVersionTagNamePart(String version, CalculateRuleForSinceTagName calculateRuleForSinceTagName) {
if (calculateRuleForSinceTagName.equals(CalculateRuleForSinceTagName.NO_RULE)) {
return null;
}
ArtifactVersion artifactVersion = parseArtifactVersion(version);
int major = artifactVersion.getMajorVersion();
int minor = artifactVersion.getMinorVersion();
int patch = artifactVersion.getIncrementalVersion();
switch (calculateRuleForSinceTagName) {
case CURRENT_MAJOR_VERSION:
minor = 0;
patch = 0;
break;
case CURRENT_MINOR_VERSION:
patch = 0;
break;
case LATEST_RELEASE_VERSION:
patch = patch == 0 ? 0 : patch - 1;
break;
default:
throw new RuntimeException("cannot parse " + calculateRuleForSinceTagName);
}
return major + "." + minor + "." + patch;
}
示例3: innerGetSegmentCount
import org.apache.maven.artifact.versioning.ArtifactVersion; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
protected int innerGetSegmentCount( ArtifactVersion v )
{
// if the version does not match the maven rules, then we have only one segment
// i.e. the qualifier
if ( v.getBuildNumber() != 0 )
{
// the version was successfully parsed, and we have a build number
// have to have four segments
return 4;
}
if ( ( v.getMajorVersion() != 0 || v.getMinorVersion() != 0 || v.getIncrementalVersion() != 0 )
&& v.getQualifier() != null )
{
// the version was successfully parsed, and we have a qualifier
// have to have four segments
return 4;
}
final String version = v.toString();
if ( version.indexOf( '-' ) != -1 )
{
// the version has parts and was not parsed successfully
// have to have one segment
return version.equals( v.getQualifier() ) ? 1 : 4;
}
if ( version.indexOf( '.' ) != -1 )
{
// the version has parts and was not parsed successfully
// have to have one segment
return version.equals( v.getQualifier() ) ? 1 : 3;
}
if ( StringUtils.isEmpty( version ) )
{
return 3;
}
try
{
Integer.parseInt( version );
return 3;
}
catch ( NumberFormatException e )
{
return 1;
}
}
示例4: filter
import org.apache.maven.artifact.versioning.ArtifactVersion; //导入方法依赖的package包/类
/**
* @param selectedVersion The version which will be checked.
* @param newerVersions The list of identified versions which are greater or equal than the selectedVersion.
* @return The cleaned up list which obeys usage of {@link #allowMajorUpdates}, {@link #allowMinorUpdates},
* {@link #allowIncrementalUpdates}.
*/
public ArtifactVersion[] filter( ArtifactVersion selectedVersion, ArtifactVersion[] newerVersions )
{
List<ArtifactVersion> versionsToUse = new LinkedList<ArtifactVersion>();
for ( ArtifactVersion artifactVersion : newerVersions )
{
if ( artifactVersion.getMajorVersion() != selectedVersion.getMajorVersion() )
{
if ( allowMajorUpdates )
{
if ( !versionsToUse.contains( artifactVersion ) )
{
versionsToUse.add( artifactVersion );
}
}
}
else if ( artifactVersion.getMinorVersion() != selectedVersion.getMinorVersion() )
{
if ( allowMinorUpdates )
{
if ( !versionsToUse.contains( artifactVersion ) )
{
versionsToUse.add( artifactVersion );
}
}
}
else if ( artifactVersion.getIncrementalVersion() != selectedVersion.getIncrementalVersion() )
{
if ( allowIncrementalUpdates )
{
if ( !versionsToUse.contains( artifactVersion ) )
{
versionsToUse.add( artifactVersion );
}
}
}
else
{
if ( allowMajorUpdates && allowMinorUpdates && allowIncrementalUpdates )
{
if ( !versionsToUse.contains( artifactVersion ) )
{
versionsToUse.add( artifactVersion );
}
}
}
}
return versionsToUse.toArray( new ArtifactVersion[versionsToUse.size()] );
}