com.smartcodeltd.domain
Class Version

java.lang.Object
  extended by com.smartcodeltd.domain.Version

public class Version
extends Object


Constructor Summary
Version(String projectVersion)
           
Version(String projectVersion, SystemTime time)
           
 
Method Summary
 String formattedWith(String template)
          Formats the version as per the template provided.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Version

public Version(String projectVersion)

Version

public Version(String projectVersion,
               SystemTime time)
Method Detail

formattedWith

public String formattedWith(String template)
Formats the version as per the template provided. For example, assume pom version '1.2.5-beta-2-SNAPSHOT'. If a template contains one of the following tokens, they will be replaced as follows:
   "{{ version }}"                   => "1.2.5-beta-2-SNAPSHOT"
   "{{ api_version }}"               => "1.2.5"
   "{{ qualified_api_version }}"     => "1.2.5-beta-2"
   "{{ timestamp('YYYYMMddHHmm') }}" => "201507302354"
 
This allows you to do more interesting things. If you specified a following template:
   "{{ qualified_api_version }}-{{ timestamp('YYYYMMddHHmm') }}"
 
you'd get:
   "1.2.5-beta-2-201507302354"
 

Parameters:
template - A template to format the version with
Returns:
project version with tokens substituted by calculated values

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016 smartcode ltd. All rights reserved.