Mercurial > hg > release > thermostat-0.4
view common/core/src/main/java/com/redhat/thermostat/common/cli/CommandWithInfo.java @ 651:205565370bab
Move command usage to properties file
Reviewed-by: sgehwolf
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-September/003395.html
author | Jon VanAlten <vanaltj@gmail.com> |
---|---|
date | Tue, 02 Oct 2012 17:43:38 -0400 |
parents | 486a299ab905 |
children | e88742733601 |
line wrap: on
line source
package com.redhat.thermostat.common.cli; import org.apache.commons.cli.Options; public abstract class CommandWithInfo implements Command { private CommandInfo info; private static final String noDesc = "Description not available."; private static final String noUsage = "Usage not available."; void setCommandInfo(CommandInfo info) { this.info = info; } @Override public String getDescription() { String desc = null; try { desc = info.getDescription(); } catch (NullPointerException infoWasNotSet) {} if (desc == null) { desc = noDesc; } return desc; } @Override public String getUsage() { String usage = null; try { usage = info.getUsage(); } catch (NullPointerException infoNotSet) {} if (usage == null) { usage = noUsage; } return usage; } @Override public Options getOptions() { // TODO Auto-generated method stub return null; } @Override public boolean isStorageRequired() { // TODO Auto-generated method stub return false; } @Override public boolean isAvailableInShell() { // TODO Auto-generated method stub return false; } @Override public boolean isAvailableOutsideShell() { // TODO Auto-generated method stub return false; } }