本文整理汇总了Java中org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast方法的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.isJavaVersionAtLeast方法的具体用法?Java SystemUtils.isJavaVersionAtLeast怎么用?Java SystemUtils.isJavaVersionAtLeast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.isJavaVersionAtLeast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateJdkVersion
import org.apache.commons.lang3.SystemUtils; //导入方法依赖的package包/类
public static void validateJdkVersion() {
boolean warn = false;
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
// We need 1.8.0_111 at least
String version = SystemUtils.JAVA_VERSION;
int ix = version.lastIndexOf('_');
if (ix > 0) {
int patch = Integer.valueOf(version.substring(ix + 1));
if (patch < 111) {
warn = true;
}
}
}
else {
// Not even Java 1.8
warn = true;
}
if (warn) {
new Log(VersionUtils.class).info(Style.yellow(
"Please update your Java™ Runtime Environment (JRE) from %s to version 1.8.0_111 or newer.",
SystemUtils.JAVA_VERSION));
}
}
示例2: apply
import org.apache.commons.lang3.SystemUtils; //导入方法依赖的package包/类
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
Object top = stack.pop();
long instant;
if (top instanceof String) {
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
instant = io.warp10.script.unary.TOTIMESTAMP.parseTimestamp(top.toString());
} else {
instant = fmt.parseDateTime((String) top).getMillis() * Constants.TIME_UNITS_PER_MS;
}
} else if (!(top instanceof Long)) {
throw new WarpScriptException(getName() + " expects a timestamp or ISO8601 datetime string on top of the stack.");
} else {
instant = ((Number) top).longValue();
}
long now = TimeSource.getTime();
if (now < instant) {
throw new WarpScriptException("Current time is before '" + top + "'");
}
return stack;
}
示例3: apply
import org.apache.commons.lang3.SystemUtils; //导入方法依赖的package包/类
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
Object top = stack.pop();
long instant;
if (top instanceof String) {
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
instant = io.warp10.script.unary.TOTIMESTAMP.parseTimestamp(top.toString());
} else {
instant = fmt.parseDateTime((String) top).getMillis() * Constants.TIME_UNITS_PER_MS;
}
} else if (!(top instanceof Long)) {
throw new WarpScriptException(getName() + " expects a timestamp or ISO8601 datetime string on top of the stack.");
} else {
instant = ((Number) top).longValue();
}
long now = TimeSource.getTime();
if (now > instant) {
throw new WarpScriptException("Current time is after '" + top + "'");
}
return stack;
}
示例4: visit
import org.apache.commons.lang3.SystemUtils; //导入方法依赖的package包/类
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
if( (version == Opcodes.V1_8 && !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) ||
(version == Opcodes.V1_7 && !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7)) )
{
if(classMap.containsKey(name)) blame(classMap.get(name), name);
else orphanNaughtyClasses.add(name);
}
}
示例5: retrieveParameters
import org.apache.commons.lang3.SystemUtils; //导入方法依赖的package包/类
@Override
protected Map<String, Object> retrieveParameters(WarpScriptStack stack) throws WarpScriptException {
Object top = stack.pop();
long start;
boolean iso8601 = false;
if (top instanceof String) {
iso8601 = true;
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
start = io.warp10.script.unary.TOTIMESTAMP.parseTimestamp(top.toString());
} else {
start = fmt.parseDateTime(top.toString()).getMillis() * Constants.TIME_UNITS_PER_MS;
}
} else if (!(top instanceof Long)) {
throw new WarpScriptException(getName() + " expects either an ISO8601 timestamp as the origin timestamp or a duration.");
} else {
start = (long) top;
}
long end;
top = stack.pop();
if (top instanceof String) {
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
end = io.warp10.script.unary.TOTIMESTAMP.parseTimestamp(top.toString());
} else {
end = fmt.parseDateTime(top.toString()).getMillis() * Constants.TIME_UNITS_PER_MS;
}
} else if (!(top instanceof Long)) {
throw new WarpScriptException(getName() + " expects either an ISO8601 timestamp or a delta since Unix Epoch as 'now' parameter.");
} else {
end = (long) top;
}
if (!iso8601) {
start = end - start + 1;
}
Map<String,Object> params = new HashMap<String, Object>();
params.put(START, start);
params.put(END, end);
return params;
}