當前位置: 首頁>>代碼示例>>Java>>正文


Java SystemUtils.isJavaVersionAtLeast方法代碼示例

本文整理匯總了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));
    }
}
 
開發者ID:atomist-attic,項目名稱:rug-cli,代碼行數:25,代碼來源:VersionUtils.java

示例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;
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:27,代碼來源:NOTBEFORE.java

示例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;
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:27,代碼來源:NOTAFTER.java

示例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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:11,代碼來源:BlamingTransformer.java

示例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;
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:51,代碼來源:TIMECLIP.java


注:本文中的org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。