All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fathzer.launcher.Version Maven / Gradle / Ivy

Go to download

A java application launcher that checks if used JRE is compatible with launched application

The newest version!
package com.fathzer.launcher;

import java.math.BigDecimal;

/** A java version.
 */
public class Version implements Comparable {
	private final String asString;
	private final BigDecimal asBigDecimal;
	
	/** Constructor.
	 * @param version The java main version in the same format as the java.specification.version system property. 
	 */
	public Version(String version) {
		this.asString = version;
		asBigDecimal = new BigDecimal(version);
	}

	public int compareTo(Object o) {
		return asBigDecimal.compareTo(((Version)o).asBigDecimal);
	}
	
	public int hashCode() {
		return asBigDecimal.hashCode();
	}

	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null || getClass() != obj.getClass()) {
			return false;
		}
		Version other = (Version) obj;
		return asBigDecimal.equals(other.asBigDecimal);
	}

	public String toString() {
		return asString;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy