com.beust.jcommander.Parameters.commandDescription()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(105)

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

Parameters.commandDescription介绍

暂无

代码示例

代码示例来源:origin: com.beust/jcommander

  1. /**
  2. * @return the description of the command.
  3. */
  4. public String getCommandDescription(String commandName) {
  5. JCommander jc = findCommandByAlias(commandName);
  6. if (jc == null) {
  7. throw new ParameterException("Asking description for unknown command: " + commandName);
  8. }
  9. Object arg = jc.getObjects().get(0);
  10. Parameters p = arg.getClass().getAnnotation(Parameters.class);
  11. ResourceBundle bundle = null;
  12. String result = null;
  13. if (p != null) {
  14. result = p.commandDescription();
  15. String bundleName = p.resourceBundle();
  16. if (!"".equals(bundleName)) {
  17. bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
  18. } else {
  19. bundle = options.bundle;
  20. }
  21. if (bundle != null) {
  22. String descriptionKey = p.commandDescriptionKey();
  23. if (!"".equals(descriptionKey)) {
  24. result = getI18nString(bundle, descriptionKey, p.commandDescription());
  25. }
  26. }
  27. }
  28. return result;
  29. }

代码示例来源:origin: org.visallo/visallo-cli

  1. private String getDescription(Class<? extends CommandLineTool> commandLineToolClass) {
  2. Parameters parameters = commandLineToolClass.getAnnotation(Parameters.class);
  3. if (parameters == null) {
  4. return "";
  5. }
  6. return parameters.commandDescription();
  7. }

代码示例来源:origin: testwhat/SmaliEx

  1. @Nullable
  2. public static String getCommandDescription(@Nonnull JCommander jc) {
  3. Parameters parameters = jc.getObjects().get(0).getClass().getAnnotation(Parameters.class);
  4. if (parameters == null) {
  5. return null;
  6. }
  7. return parameters.commandDescription();
  8. }
  9. }

代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang

  1. /**
  2. * @return the description of the command.
  3. */
  4. public String getCommandDescription(String commandName) {
  5. JCommander jc = findCommandByAlias(commandName);
  6. if (jc == null) {
  7. throw new ParameterException("Asking description for unknown command: " + commandName);
  8. }
  9. Parameters p = jc.getObjects().get(0).getClass().getAnnotation(Parameters.class);
  10. String result = jc.getMainParameterDescription();
  11. if (p != null) result = getI18nString(p.commandDescriptionKey(), p.commandDescription());
  12. return result;
  13. }

代码示例来源:origin: io.ballerina.messaging/broker-cli-client

  1. /**
  2. * Extract command description from the jCommander instance and append it to the StringBuilder.
  3. *
  4. * @param jCommander respective JCommander instance.
  5. * @param sb StringBuilder instance.
  6. */
  7. static void appendCommandDescription(JCommander jCommander, StringBuilder sb) {
  8. MBClientCmd selfCommand = (MBClientCmd) jCommander.getObjects().get(0);
  9. // if no description is provided, return from here
  10. if (selfCommand.getClass().getAnnotations().length == 0) {
  11. return;
  12. }
  13. Parameters parameters = (Parameters) selfCommand.getClass().getAnnotations()[0];
  14. String commandDescription = parameters.commandDescription();
  15. sb.append(commandDescription);
  16. sb.append("\n\n");
  17. }

代码示例来源:origin: locationtech/geowave

  1. op_json.addProperty("description", command_annotation.commandDescription());

代码示例来源:origin: locationtech/geowave

  1. tEntry.getObject().getClass().getAnnotation(Parameters.class);
  2. if (parameters != null) {
  3. builder.append(parameters.commandDescription());
  4. } else {
  5. builder.append("Additional Parameters");

代码示例来源:origin: locationtech/geowave

  1. builder.append(String.format(" %s%n", childEntry.getOperationName()));
  2. if (p != null) {
  3. String description = p.commandDescription();
  4. builder.append(String.format(" %s%n", description));
  5. } else {

相关文章