com.sun.tools.xjc.api.SpecVersion Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.tools.xjc.api;
/**
* Represents the spec version constant.
*
* @author Kohsuke Kawaguchi
*/
public enum SpecVersion {
V2_3("2.3"), V3_0("3.0");
private final String version;
SpecVersion(String version) {
this.version = version;
}
/**
* Returns true if this version is equal or later than the given one.
*/
public boolean isLaterThan(SpecVersion t) {
return this.ordinal()>=t.ordinal();
}
/**
* Parses "3.0" into the object.
*
* @return null for parsing failure.
*/
public static SpecVersion parse(String token) {
for (SpecVersion version : SpecVersion.values()) {
if (version.getVersion().equals(token)) {
return version;
}
}
return null;
}
/**
* Gives the String representation of the
*/
public String getVersion(){
return version;
}
public static final SpecVersion LATEST = V3_0;
}