View Javadoc
1   package com.simpligility.maven.plugins.android.configuration;
2   
3   import org.apache.maven.plugin.MojoExecutionException;
4   
5   /**
6    * VersionElementParser implementing the old version generator behavior.
7    *
8    * @author Wang Xuerui  - idontknw.wang@gmail.com
9    *
10   */
11  public class SimpleVersionElementParser implements VersionElementParser
12  {
13  
14      @Override
15      public int[] parseVersionElements( final String versionName ) throws MojoExecutionException
16      {
17          final String[] versionNameElements = versionName.replaceAll( "[^0-9.]", "" ).split( "\\." );
18          int[] result = new int[versionNameElements.length];
19  
20          for ( int i = 0; i < versionNameElements.length; i++ )
21          {
22              result[i] = Integer.valueOf( versionNameElements[i] );
23          }
24  
25          return result;
26      }
27  }