Package org.freeplane.core.util
Class FreeplaneVersion
java.lang.Object
org.freeplane.core.util.FreeplaneVersion
- All Implemented Interfaces:
java.lang.Comparable<FreeplaneVersion>,FreeplaneVersion
public class FreeplaneVersion extends java.lang.Object implements FreeplaneVersion
provides access to the current Freeplane version. In scripts use
c.freeplaneVersion.
For usage instructions see compareTo(org.freeplane.api.FreeplaneVersion).-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVERSION_KEYstatic java.lang.StringVERSION_PROPERTIESstatic java.lang.StringXML_VERSION -
Constructor Summary
Constructors Constructor Description FreeplaneVersion(int pMaj, int pMid, int pMin)FreeplaneVersion(int pMaj, int pMid, int pMin, java.lang.String pType, int pNum) -
Method Summary
Modifier and Type Method Description intcompareTo(FreeplaneVersion o)Use it like this:intgetMaj()intgetMid()intgetMin()intgetNum()java.lang.StringgetRevision()java.lang.StringgetType()static FreeplaneVersiongetVersion()static FreeplaneVersiongetVersion(java.lang.String pString)Parses a version string as FreeplaneVersion.booleanisFinal()booleanisNewerThan(FreeplaneVersion freeplaneVersion)booleanisOlderThan(FreeplaneVersion freeplaneVersion)java.lang.StringnumberToString()returns the version number only, e.g. "1.0.38".java.lang.StringtoString()returns the full version number, e.g. "1.0.38 rc".Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
VERSION_KEY
public static final java.lang.String VERSION_KEY- See Also:
- Constant Field Values
-
VERSION_PROPERTIES
public static final java.lang.String VERSION_PROPERTIES- See Also:
- Constant Field Values
-
XML_VERSION
public static final java.lang.String XML_VERSION- See Also:
- Constant Field Values
-
-
Constructor Details
-
FreeplaneVersion
public FreeplaneVersion(int pMaj, int pMid, int pMin, java.lang.String pType, int pNum) -
FreeplaneVersion
public FreeplaneVersion(int pMaj, int pMid, int pMin)
-
-
Method Details
-
getVersion
-
getVersion
public static FreeplaneVersion getVersion(java.lang.String pString) throws java.lang.IllegalArgumentExceptionParses a version string as FreeplaneVersion. Ignores leading 'v' (e.g. "v1.2.6") and accept '.' and ' ' as separator.- Throws:
java.lang.IllegalArgumentException- on parse errors
-
getMaj
public int getMaj()- Specified by:
getMajin interfaceFreeplaneVersion
-
getMid
public int getMid()- Specified by:
getMidin interfaceFreeplaneVersion
-
getMin
public int getMin()- Specified by:
getMinin interfaceFreeplaneVersion
-
getNum
public int getNum()- Specified by:
getNumin interfaceFreeplaneVersion
-
getType
public java.lang.String getType()- Specified by:
getTypein interfaceFreeplaneVersion
-
getRevision
public java.lang.String getRevision()- Specified by:
getRevisionin interfaceFreeplaneVersion
-
compareTo
Use it like this:import org.freeplane.core.util.FreeplaneVersion def required = FreeplaneVersion.getVersion("1.2.20") if (c.freeplaneVersion < required) ui.errorMessage("Freeplane version ${c.freeplaneVersion}" + " not supported - update to at least ${required}")- Specified by:
compareToin interfacejava.lang.Comparable<FreeplaneVersion>
-
toString
public java.lang.String toString()returns the full version number, e.g. "1.0.38 rc".- Overrides:
toStringin classjava.lang.Object
-
numberToString
public java.lang.String numberToString()returns the version number only, e.g. "1.0.38".- Specified by:
numberToStringin interfaceFreeplaneVersion
-
isOlderThan
- Specified by:
isOlderThanin interfaceFreeplaneVersion
-
isNewerThan
- Specified by:
isNewerThanin interfaceFreeplaneVersion
-
isFinal
public boolean isFinal()- Specified by:
isFinalin interfaceFreeplaneVersion
-