org.codehaus.modello.model.Version类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.codehaus.modello.model.Version类的一些代码示例,展示了Version类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version类的具体详情如下:
包路径:org.codehaus.modello.model.Version
类名称:Version

Version介绍

[英]A version string is on the form <major>.<minor>.<micro>.
[中]版本字符串的格式为<major><小调><micro>。

代码示例

代码示例来源:origin: org.codehaus.modello/modello-core

public String toString()
{
  return toString( "", "." );
}

代码示例来源:origin: org.codehaus.modello/modello-core

public VersionRange( String versionRange )
{
  if ( versionRange.endsWith( "+" ) )
  {
    fromVersion = new Version( versionRange.substring( 0, versionRange.length() - 1 ) );
    toVersion = Version.INFINITE;
  }
  else if ( versionRange.indexOf( VERSION_SEPARATOR ) > 0 && ! versionRange.endsWith( VERSION_SEPARATOR ) )
  {
    int pos = versionRange.indexOf( VERSION_SEPARATOR );
    fromVersion = new Version( versionRange.substring( 0, pos ) );
    toVersion = new Version( versionRange.substring( pos + 1 ) );
  }
  else
  {
    fromVersion = new Version( versionRange );
    toVersion = new Version( versionRange );
  }
}

代码示例来源:origin: org.codehaus.modello/modello-core

public boolean inside( VersionRange range )
{
  if ( range.getFromVersion().equals( this ) )
  {
    return true;
  }
  else if ( ( this.greaterThan( range.getFromVersion() ) ) && ( this.lesserThan( range.getToVersion() ) ) )
  {
    return true;
  }
  else if ( this.equals( range.getFromVersion() ) || this.equals( range.getToVersion() ) )
  {
    return true;
  }
  return false;
}

代码示例来源:origin: org.codehaus.modello/modello-core

public String toString()
  {
    if ( fromVersion.equals( toVersion ) )
    {
      return fromVersion.toString( "", "." );
    }
    else if ( toVersion.equals( Version.INFINITE ) )
    {
      return fromVersion.toString( "", "." ) + "+";
    }
    else
    {
      return "[" + fromVersion.toString( "", "." ) + " => " + toVersion.toString( "", "." ) + "]";
    }
  }
}

代码示例来源:origin: org.codehaus.modello/modello-core

public int compareTo( Version otherVersion )
  {
    if ( greaterThan( otherVersion ) )
    {
      return +1;
    }
    else if ( equals( otherVersion ) )
    {
      return 0;
    }
    else
    {
      return -1;
    }
  }
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xdoc

boolean showSinceColumn = version.greaterThan( firstVersion );
      if ( fromVersion != null && fromVersion.greaterThan( firstVersion ) )
        w.writeMarkup( fromVersion.toString() );

代码示例来源:origin: org.codehaus.modello/modello-plugin-converters

for ( String version : versions )
  allVersions.add( new Version( version ) );
for ( Version v : allVersions )
  if ( v.greaterThan( getGeneratedVersion() ) )

代码示例来源:origin: org.codehaus.modello/modello-core

public List<ModelInterface> getInterfaces( Version version )
{
  List<ModelInterface> interfaceList = new ArrayList<ModelInterface>();
  for ( ModelInterface currentInterface : interfaces )
  {
    if ( version.inside( currentInterface.getVersionRange() ) )
    {
      interfaceList.add( currentInterface );
    }
  }
  return interfaceList;
}

代码示例来源:origin: org.codehaus.modello/modello-core

public boolean equals( Object obj )
{
  if ( !( obj instanceof VersionRange ) )
  {
    return false;
  }
  VersionRange other = (VersionRange) obj;
  return fromVersion.equals( other.fromVersion ) && toVersion.equals( other.toVersion );
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-converters

if ( v != null )
  methodName += "_" + v.toString( "v", "_" );
      if ( targetVersion.equals( sourceVersion ) )
    if ( targetVersion.equals( v ) )
  if ( sourceVersion.equals( v ) )

代码示例来源:origin: org.codehaus.modello/modello-core

public List<ModelClass> getClasses( Version version )
{
  List<ModelClass> classList = new ArrayList<ModelClass>();
  for ( ModelClass currentClass : classes )
  {
    if ( version.inside( currentClass.getVersionRange() ) )
    {
      classList.add( currentClass );
    }
  }
  return classList;
}

代码示例来源:origin: org.codehaus.modello/modello-core

public void validateElement()
  throws ModelValidationException
{
  // Check if superClass exists
  if ( hasSuperClass() )
  {
    try
    {
      getModel().getClass( superClass, getVersionRange() );
      isInternalSuperClass = true;
    }
    catch ( ModelloRuntimeException e )
    {
      isInternalSuperClass = false;
    }
  }
  if ( getModel().getDefault( ModelDefault.CHECK_DEPRECATION ).getBoolean() )
  {
    if ( ! Version.INFINITE.equals( getVersionRange().getToVersion() )
       && getDeprecatedVersion() == null )
    {
      throw new ModelValidationException( "You must define the deprecated version of '" + getName() + "' class." );
    }
  }
}

代码示例来源:origin: org.codehaus.modello/modello-core

public int hashCode()
{
  return toString( "", null ).hashCode();
}

代码示例来源:origin: org.codehaus.modello/modello-core

protected void initialize( Model model, Properties parameters )
  throws ModelloException
{
  this.model = model;
  outputDirectory = new File( getParameter( parameters, ModelloParameterConstants.OUTPUT_DIRECTORY ) );
  String version = getParameter( parameters, ModelloParameterConstants.VERSION );
  generatedVersion = new Version( version );
  packageWithVersion =
    Boolean.valueOf( getParameter( parameters, ModelloParameterConstants.PACKAGE_WITH_VERSION ) );
  encoding = parameters.getProperty( ModelloParameterConstants.ENCODING );
}

代码示例来源:origin: org.codehaus.modello/modello-core

public List<ModelField> getAllFields( Version version, boolean withInheritedField )
{
  List<ModelField> allFieldsList = new ArrayList<ModelField>();
  List<ModelField> fieldList = new ArrayList<ModelField>();
  for ( ModelField currentField : getAllFields( withInheritedField ) )
  {
    if ( version.inside( currentField.getVersionRange() ) )
    {
      allFieldsList.add( currentField );
    }
  }
  for ( ModelField currentField : allFieldsList )
  {
    if ( version.inside( currentField.getVersionRange() ) )
    {
      fieldList.add( currentField );
    }
  }
  return fieldList;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

public String getNamespace( Version version )
{
  String namespace = this.namespace;
  if ( version != null )
  {
    namespace = StringUtils.replace( namespace, "${version}", version.toString() );
  }
  return namespace;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xdoc

public void generate( Model model, Properties parameters )
  throws ModelloException
{
  initialize( model, parameters );
  if ( parameters.getProperty( ModelloParameterConstants.FIRST_VERSION ) != null )
  {
    firstVersion = new Version( parameters.getProperty( ModelloParameterConstants.FIRST_VERSION ) );
  }
  if ( parameters.getProperty( ModelloParameterConstants.VERSION ) != null )
  {
    version = new Version( parameters.getProperty( ModelloParameterConstants.VERSION ) );
  }
  try
  {
    generateXdoc( parameters );
  }
  catch ( IOException ex )
  {
    throw new ModelloException( "Exception while generating XDoc.", ex );
  }
}

代码示例来源:origin: org.codehaus.modello/modello-core

/**
 * Returns the list of all fields in this class for a specific version.
 *
 * It does not include the fields of super classes.
 *
 * @param version the specific version
 * @return Returns the list of all fields in this class. It does not include the
 *         fields of super classes.
 */
public List<ModelField> getFields( Version version )
{
  List<ModelField> fieldList = new ArrayList<ModelField>();
  for ( ModelField currentField : getAllFields() )
  {
    if ( version.inside( currentField.getVersionRange() ) )
    {
      fieldList.add( currentField );
    }
  }
  return fieldList;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xsd

public String getNamespace( Version version )
{
  String namespace = this.namespace;
  if ( version != null )
  {
    namespace = StringUtils.replace( namespace, "${version}", version.toString() );
  }
  return namespace;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-stax

sc.addIndented( "return new " + getModel().getDefaultPackageName( true, new Version( version ) )
        + ".io.stax." + getFileName( "StaxReader" ) + "().read( reader, strict );" );
sc.add( "}" );

相关文章