summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/cli/GenericHelp.java
blob: f4095f3888e9dd59cb903c07ee3409c60b3916a7 (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
43
44
45
46
47
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;
	}

}