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


Java ArtifactVersion.getBuildNumber方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:48,代码来源:MavenVersionComparator.java


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