本文整理汇总了Java中org.apache.maven.artifact.versioning.ArtifactVersion.getBuildNumber方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactVersion.getBuildNumber方法的具体用法?Java ArtifactVersion.getBuildNumber怎么用?Java ArtifactVersion.getBuildNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.versioning.ArtifactVersion
的用法示例。
在下文中一共展示了ArtifactVersion.getBuildNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}