Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.pentaho.versionchecker.util;

Bean that holds the results of the version information

Author(s):
dkincade
  
  public class VersionInfo {
  
The product id of the product
 
   private String productID;

  
The text title of the product
 
   private String title;

  
The major portion of the version number
 
   private String versionMajor;

  
The minor portion of the version number
 
   private String versionMinor;
  
  
The release portion of the version number
 
   private String versionRelease;

  
The milestone portion of the version number
 
   private String versionMilestone;

  
THe build number portion of the version number
 
   private String versionBuild;

  
Boolean indicating if this was retrieved from the manifest (indicating that it is running from a build) or from class files (indicating it is running from compiled class files).
 
   private boolean fromManifest;
 
   public boolean isFromManifest() {
     return ;
   }
 
   public String getProductID() {
     return ;
   }
 
   public String getTitle() {
     return ;
   }
 
   public String getVersionMajor() {
     return ;
   }
 
   public String getVersionMinor() {
     return ;
   }
 
   public String getVersionRelease() {
     return ;
   }
 
   public String getVersionMilestone() {
     return ;
   }
 
   public String getVersionBuild() {
     return ;
   }
 
   public String getVersionNumber() {
     StringBuffer sb = new StringBuffer();
     if ( != null) {
       sb.append();
       if ( != null) {
         sb.append('.').append();
         if ( != null) {
           sb.append('.').append();
           if ( != null) {
             sb.append('.').append();
             if ( != null) {
               sb.append('.').append();
             }
           }
         }
       }
     }
     return sb.toString();
  }
  
  public String toString() {
    StringBuffer sb = new StringBuffer();
    sb.append("fromManifest       = [").append().append("]\n"); //$NON-NLS-1$  //$NON-NLS-2$
    sb.append("productID          = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("title              = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("versionMajor       = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("versionMinor       = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("versionRelease     = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("versionMilestone   = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("versionBuild       = [").append().append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("getVersionNumber() = [").append(getVersionNumber()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
    return sb.toString();
  }
  public void setFromManifest(boolean fromManifest) {
    this. = fromManifest;
  }
  public void setProductID(String productID) {
    this. = productID;
  }
  public void setTitle(String title) {
    this. = title;
  }
  public void setVersionMajor(String versionMajor) {
    this. = versionMajor;
  }
  public void setVersionMinor(String versionMinor) {
    this. = versionMinor;
  }
  public void setVersionRelease(String versionRelease) {
    this. = versionRelease;
  }
  public void setVersionMilestone(String versionMilestone) {
    this. = versionMilestone;
  }
  public void setVersionBuild(String versionBuild) {
    this. = versionBuild;
  }

  
Sets the version fields by passing the whole string and parsing it.
NOTE: spaces will be changed to dots before parsing

Parameters:
version the version number (1.6.0.GA.500 or 1.6.0-RC2.400)
  public void setVersion(String version) {
    // Parse the version
    if (version != null) {
      String [] pieces = version.replace('-''.').split("\\."); //$NON-NLS-1$
      switch (pieces.length) {
        case 9: // just in case
        case 8: // just in case
        case 7: // just in case
        case 6: // just in case
        case 5: setVersionBuild(pieces[4]);      // intentional fall through
        case 4: setVersionMilestone(pieces[3]);  // intentional fall through 
        case 3: setVersionRelease(pieces[2]);    // intentional fall through
        case 2: setVersionMinor(pieces[1]);      // intentional fall through
        case 1: setVersionMajor(pieces[0]);      // intentional fall through
        default// do nothing
      }
    }
  }
New to GrepCode? Check out our FAQ X