本文整理汇总了Java中org.apache.commons.lang3.JavaVersion类的典型用法代码示例。如果您正苦于以下问题:Java JavaVersion类的具体用法?Java JavaVersion怎么用?Java JavaVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaVersion类属于org.apache.commons.lang3包,在下文中一共展示了JavaVersion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateJdkVersion
import org.apache.commons.lang3.JavaVersion; //导入依赖的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.JavaVersion; //导入依赖的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.JavaVersion; //导入依赖的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: setupFrameworkSupport
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@Override
public void setupFrameworkSupport(JavaeeFrameworkSupportContributionModel model) {
AppEngineStandardFacet appEngineStandardFacet = model.getFacet(AppEngineStandardFacetType.ID);
if (appEngineStandardFacet == null) {
return;
}
if (appEngineStandardFacet.getRuntimeJavaVersion().equals(JavaVersion.JAVA_1_7)) {
setWebXmlServletVersion(model.getModule());
}
Artifact artifactToDeploy = model.getExplodedEarArtifact();
if (artifactToDeploy == null) {
artifactToDeploy = model.getExplodedWarArtifact();
}
if (artifactToDeploy != null) {
AppEngineStandardWebIntegration.getInstance()
.setupRunConfigurations(artifactToDeploy, model.getModule(), model.getRunConfiguration());
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:21,代码来源:AppEngineJavaeeSupportContributor.java
示例5: findAppEngineModulesUsingUnsupportedLanguageLevel
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
private List<Module> findAppEngineModulesUsingUnsupportedLanguageLevel(final Project project) {
final Module[] projectModules = ModuleManager.getInstance(project).getModules();
final List<Module> invalidModules = new ArrayList<>();
ApplicationManager.getApplication()
.runReadAction(
() -> {
Arrays.stream(projectModules)
.filter(this::usesJava8OrGreater)
.filter(
module -> {
AppEngineStandardFacet facet =
AppEngineStandardFacet.getAppEngineFacetByModule(module);
return !(facet == null || facet.isNonStandardCompatEnvironment())
&& facet.getRuntimeJavaVersion().compareTo(JavaVersion.JAVA_1_8) < 0;
})
.forEach(invalidModules::add);
});
return invalidModules;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:21,代码来源:AppEngineStandardUnsupportedJavaVersionCheck.java
示例6: data
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
List<Object[]> list = Arrays.asList(
// @formatter:off
new Object[][] { { HmacAlgorithms.HMAC_MD5, STANDARD_MD5_RESULT_BYTES, STANDARD_MD5_RESULT_STRING },
{ HmacAlgorithms.HMAC_SHA_1, STANDARD_SHA1_RESULT_BYTES, STANDARD_SHA1_RESULT_STRING },
{ HmacAlgorithms.HMAC_SHA_256, STANDARD_SHA256_RESULT_BYTES, STANDARD_SHA256_RESULT_STRING },
{ HmacAlgorithms.HMAC_SHA_384, STANDARD_SHA384_RESULT_BYTES, STANDARD_SHA384_RESULT_STRING },
{ HmacAlgorithms.HMAC_SHA_512, STANDARD_SHA512_RESULT_BYTES, STANDARD_SHA512_RESULT_STRING } });
// @formatter:on
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) {
list = new ArrayList<Object[]>(list);
list.add(new Object[] {HmacAlgorithms.HMAC_SHA_224, STANDARD_SHA224_RESULT_BYTES, STANDARD_SHA224_RESULT_STRING});
}
return list;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-codec,代码行数:17,代码来源:HmacAlgorithmsTest.java
示例7: visit
import org.apache.commons.lang3.JavaVersion; //导入依赖的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
示例8: getRuntimeJavaVersion
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
/**
* Returns the {@link JavaVersion} of the Java runtime, as defined in the {@code
* appengine-web.xml}.
*
* <p>If no runtime is specified in the {@code appengine-web.xml} or if the specified runtime is
* not valid, {@link JavaVersion#JAVA_1_7} is returned.
*/
public JavaVersion getRuntimeJavaVersion() {
AppEngineStandardWebApp appEngineStandardWebApp = getAppEngineStandardWebXml();
if (appEngineStandardWebApp != null) {
String runtimeString = appEngineStandardWebApp.getRuntime().getStringValue();
JavaVersion runtimeVersion = RUNTIMES_MAP.get(runtimeString);
if (runtimeVersion != null) {
return runtimeVersion;
}
}
// The default runtime is Java 7.
return JavaVersion.JAVA_1_7;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:21,代码来源:AppEngineStandardFacet.java
示例9: reportOutdatedJava
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
public static void reportOutdatedJava(JavaVersion minVersion){
String consoleReport = getConsoleReport(minVersion);
if (!ForgeCompatibility.tryLog(consoleReport)){
System.out.println(consoleReport);
}
if (!GraphicsEnvironment.isHeadless() && ForgeCompatibility.isClientSide()){
displayErrorPopup("Outdated Java", getHtmlReport(minVersion));
}
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:12,代码来源:JavaCheckerReporter.java
示例10: getConsoleReport
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
private static String getConsoleReport(JavaVersion minVersion){
return
"\n\n!! DO NOT REPORT !!\n\n"+
"One of the mods requires Java "+minVersion+" or newer, you are using "+SystemUtils.JAVA_VERSION+".\n"+
"Visit https://java.com/download/ for the latest version.\n"+
"Please, uninstall the old version first to prevent further issues."+
"\n\n!! DO NOT REPORT !!\n";
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:9,代码来源:JavaCheckerReporter.java
示例11: run
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
public static void run(JavaVersion minVersion){
try{
unsafeRun(minVersion);
}catch(OutdatedJavaException me){
throw me;
}catch(ShadingException up){
throw up;
}catch(Throwable t){
t.printStackTrace();
System.out.println("Detected an unexpected error in Java Version Checker, ignoring since trying to run the game is more important.");
System.out.println("If you crashed and happen to see this, please report the error above to: "+issueReportSite);
}
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:14,代码来源:JavaVersionChecker.java
示例12: unsafeRun
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
private static void unsafeRun(JavaVersion minVersion){
if (minVersion == null || !SystemUtils.isJavaVersionAtLeast(minVersion)){
if (minVersion == null)minVersion = JavaVersion.JAVA_1_8; // debugging purposes
JavaCheckerReporter.reportOutdatedJava(minVersion);
throw new OutdatedJavaException();
}
else{
if (isShaded() && !ForgeCompatibility.tryResetModState()){
throw new ShadingException();
}
}
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:14,代码来源:JavaVersionChecker.java
示例13: runCheck
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
/**
* Runs Java version checker.
*
* @param javaVersion Java version to check for.
* @return boolean result.
*/
public static boolean runCheck(JavaVersion javaVersion) {
if (!SystemUtils.isJavaVersionAtLeast(javaVersion))
throw new InCompatibleJavaException(String.format("Version: %s of java is not supported! Please update your Java to at least version %s!",
SystemInfo.instance().getJavaVersion(), javaVersion.toString()));
return true;
}
开发者ID:hockeyhurd,项目名称:HCoreLib,代码行数:14,代码来源:InCompatibleJavaException.java
示例14: preInit
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@EventHandler
@Override
public void preInit(FMLPreInitializationEvent event) {
tl = new TimeLapse();
logHelper = new LogHelper(LibReference.MOD_ID);
final boolean result = JavaCompatibility.runCheck(JavaVersion.JAVA_1_8);
if (result)
logHelper.info("Java version is compatible!");
logHelper.info("Pre-init started, looking for config info!");
configHandler = new ConfigHandler(event, LibReference.MOD_ID);
configHandler.handleConfiguration();
logHelper.info("Config info handled successfully! Applying changes now!");
final Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side == Side.CLIENT) {
logHelper.info("Attempting to inject data to mcmod.info file!");
final McModInfoDataInjector mcModInfoDataInjector = new McModInfoDataInjector(event, logHelper);
mcModInfoDataInjector.injectData(false, new String[] { "hockeyhurd" }, LibReference.MOD_ID, LibReference.VERSION, LibReference.HOMEPAGE_URL, null,
"A simple library for all of hockeyhurd's mods and anyone who wishes to use this as well.");
if (mcModInfoDataInjector.getResult())
logHelper.info("Injection was successful!");
else
logHelper.warn("Injection was un-successful! mcmod.info is a liar!");
}
proxy.preInit();
logHelper.info("Pre-init finished successfully after", tl.getEffectiveTimeSince(), "ms!");
}
开发者ID:hockeyhurd,项目名称:HCoreLib,代码行数:34,代码来源:HCoreLibMain.java
示例15: retrieveParameters
import org.apache.commons.lang3.JavaVersion; //导入依赖的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
示例16: injectIntoClassLoader
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader){
JavaVersionChecker.run(JavaVersion.JAVA_1_8);
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:5,代码来源:Java8Checker.java
示例17: getHtmlReport
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
private static String getHtmlReport(JavaVersion minVersion){
return
"One of the mods requires Java "+minVersion+" or newer, you are using "+SystemUtils.JAVA_VERSION+".<br>"+
"Visit <a href=\"https://java.com/download/\"><span style=\"color:blue\">https://java.com/download/</span></a> for the latest version.<br>"+
"Please, uninstall the old version first to prevent further issues.";
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:7,代码来源:JavaCheckerReporter.java
示例18: injectIntoClassLoader
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader){
JavaVersionChecker.run(JavaVersion.JAVA_1_7);
}
开发者ID:chylex,项目名称:Java-Checker,代码行数:5,代码来源:Java7Checker.java
示例19: apply
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
@Override
public boolean apply() {
return SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8);
}
开发者ID:mjeanroy,项目名称:junit-servers,代码行数:5,代码来源:AtLeastJava8.java
示例20: assumeJava8
import org.apache.commons.lang3.JavaVersion; //导入依赖的package包/类
private void assumeJava8() {
Assume.assumeTrue(SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8));
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-codec,代码行数:4,代码来源:DigestUtilsTest.java
注:本文中的org.apache.commons.lang3.JavaVersion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论