本文整理了Java中org.apache.commons.exec.OS.isOs()
方法的一些代码示例,展示了OS.isOs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OS.isOs()
方法的具体详情如下:
包路径:org.apache.commons.exec.OS
类名称:OS
方法名:isOs
[英]Determines if the OS on which Ant is executing matches the given OS family, name, architecture and version
[中]确定Ant正在执行的操作系统是否与给定的操作系统系列、名称、体系结构和版本匹配
代码示例来源:origin: org.apache.commons/commons-exec
/**
* Determines if the OS on which Ant is executing matches the given OS name.
*
* @param name
* the OS name to check for
* @return true if the OS matches
*/
public static boolean isName(final String name) {
return isOs(null, name, null, null);
}
代码示例来源:origin: org.apache.commons/commons-exec
/**
* Determines if the OS on which Ant is executing matches the given OS
* architecture.
*
* @param arch
* the OS architecture to check for
* @return true if the OS matches
*/
public static boolean isArch(final String arch) {
return isOs(null, null, arch, null);
}
代码示例来源:origin: org.apache.commons/commons-exec
/**
* Determines if the OS on which Ant is executing matches the given OS
* version.
*
* @param version
* the OS version to check for
* @return true if the OS matches
*/
public static boolean isVersion(final String version) {
return isOs(null, null, null, version);
}
代码示例来源:origin: org.apache.commons/commons-exec
/**
* Determines if the OS on which Ant is executing matches the given OS
* family. * Possible values:<br />
* <ul>
* <li>dos</li>
* <li>mac</li>
* <li>netware</li>
* <li>os/2</li>
* <li>tandem</li>
* <li>unix</li>
* <li>windows</li>
* <li>win9x</li>
* <li>z/os</li>
* <li>os/400</li>
* </ul>
*
* @param family
* the family to check for
* @return true if the OS matches
*/
private static boolean isFamily(final String family) {
return isOs(family, null, null, null);
}
代码示例来源:origin: ch.racic.testing/TestFrameworkHelper
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(description);
} else if (method.getAnnotation(TargetOS.class) != null) {
final TargetOS tos = method.getAnnotation(TargetOS.class);
String name = tos.name().equals("") ? null : tos.name();
String arch = tos.arch().equals("") ? null : tos.arch();
String version = tos.version().equals("") ? null : tos.version();
if (OS.isOs(tos.family(), name, arch, version)) {
runLeaf(methodBlock(method), description, notifier);
} else {
notifier.fireTestIgnored(description);
}
} else {
runLeaf(methodBlock(method), description, notifier);
}
}
内容来源于网络,如有侵权,请联系作者删除!