package bjc.utils.cli; import org.eclipse.jdt.annotation.Nullable; /** * Generic implementation of a help topic * * @author ben * */ public class GenericHelp implements ICommandHelp { // The strings for this help topic private String summary; private String description; /** * Create a new help topic * * @param summary * The summary of this help topic * @param description * The description of this help topic, or null if this help * topic doesn't have a more detailed description */ public GenericHelp(String summary, @Nullable String description) { if (summary == null) { throw new NullPointerException( "Help summary must be non-null"); } this.summary = summary; this.description = description; } @Override public String getDescription() { if (description == null) { return summary; } return description; } @Override public String getSummary() { return summary; } }