summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/cli/GenericHelp.java
blob: 6fa367c4f1e9622593ee7f0ef503bf30841cdd23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package bjc.utils.cli;

/**
 * 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, 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;
	}

}