1 17 package org.columba.core.versioninfo; 18 19 import java.lang.reflect.Method ; 20 import java.util.Calendar ; 21 import java.util.Date ; 22 23 24 public class VersionInfo { 25 26 private static Date TODAY = new Date (); 29 30 private static String YEAR = Integer.toString( Calendar.getInstance().get(Calendar.YEAR) ); 31 private static String MONTH = Integer.toString( Calendar.getInstance().get(Calendar.MONTH) + 1); 32 private static String DAY = Integer.toString( Calendar.getInstance().get(Calendar.DAY_OF_MONTH) ); 33 34 private static String DATE = YEAR + (MONTH.length() == 1 ? "0" : "") + MONTH + (DAY.length() == 1 ? "0" : "") + DAY; 35 36 public static String getVersion() { 37 try { 38 Method getVersionMethod = Class.forName("org.columba.core.versioninfo.ColumbaVersionInfo").getMethod("getVersion", new Class [0]); 39 40 return (String ) getVersionMethod.invoke(null,new Object [0]); 41 } catch (Exception e) { 42 return "CVS-" + DATE; 43 } 44 45 } 46 47 public static Date getBuildDate() { 48 try { 49 Method getBuildDateMethod = Class.forName("org.columba.core.versioninfo.ColumbaVersionInfo").getMethod("getBuildDate", new Class [0]); 50 51 return (Date ) getBuildDateMethod.invoke(null,new Object [0]); 52 } catch (Exception e) { 53 return TODAY; 54 } 55 56 } 57 58 } 59 | Popular Tags |