org.apache.commons.exec.OS.isOs()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.apache.commons.exec.OS.isOs()方法的一些代码示例,展示了OS.isOs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OS.isOs()方法的具体详情如下:
包路径:org.apache.commons.exec.OS
类名称:OS
方法名:isOs

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

  1. /**
  2. * Determines if the OS on which Ant is executing matches the given OS name.
  3. *
  4. * @param name
  5. * the OS name to check for
  6. * @return true if the OS matches
  7. */
  8. public static boolean isName(final String name) {
  9. return isOs(null, name, null, null);
  10. }

代码示例来源:origin: org.apache.commons/commons-exec

  1. /**
  2. * Determines if the OS on which Ant is executing matches the given OS
  3. * architecture.
  4. *
  5. * @param arch
  6. * the OS architecture to check for
  7. * @return true if the OS matches
  8. */
  9. public static boolean isArch(final String arch) {
  10. return isOs(null, null, arch, null);
  11. }

代码示例来源:origin: org.apache.commons/commons-exec

  1. /**
  2. * Determines if the OS on which Ant is executing matches the given OS
  3. * version.
  4. *
  5. * @param version
  6. * the OS version to check for
  7. * @return true if the OS matches
  8. */
  9. public static boolean isVersion(final String version) {
  10. return isOs(null, null, null, version);
  11. }

代码示例来源:origin: org.apache.commons/commons-exec

  1. /**
  2. * Determines if the OS on which Ant is executing matches the given OS
  3. * family. * Possible values:<br />
  4. * <ul>
  5. * <li>dos</li>
  6. * <li>mac</li>
  7. * <li>netware</li>
  8. * <li>os/2</li>
  9. * <li>tandem</li>
  10. * <li>unix</li>
  11. * <li>windows</li>
  12. * <li>win9x</li>
  13. * <li>z/os</li>
  14. * <li>os/400</li>
  15. * </ul>
  16. *
  17. * @param family
  18. * the family to check for
  19. * @return true if the OS matches
  20. */
  21. private static boolean isFamily(final String family) {
  22. return isOs(family, null, null, null);
  23. }

代码示例来源:origin: ch.racic.testing/TestFrameworkHelper

  1. @Override
  2. protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
  3. Description description = describeChild(method);
  4. if (method.getAnnotation(Ignore.class) != null) {
  5. notifier.fireTestIgnored(description);
  6. } else if (method.getAnnotation(TargetOS.class) != null) {
  7. final TargetOS tos = method.getAnnotation(TargetOS.class);
  8. String name = tos.name().equals("") ? null : tos.name();
  9. String arch = tos.arch().equals("") ? null : tos.arch();
  10. String version = tos.version().equals("") ? null : tos.version();
  11. if (OS.isOs(tos.family(), name, arch, version)) {
  12. runLeaf(methodBlock(method), description, notifier);
  13. } else {
  14. notifier.fireTestIgnored(description);
  15. }
  16. } else {
  17. runLeaf(methodBlock(method), description, notifier);
  18. }
  19. }

相关文章