TextCommand.java

src/net/sourceforge/pain/plugin/command/TextCommand.java · 991 B

From the archive pain_0_41.zip

Download the archive   « Back to the archive contents

package net.sourceforge.pain.plugin.command;

/**
 * TextCommand class is very simple
 * it contains command to class name(command handler) mapping
 * command mapping is loaded during startup (to build shortcut map)
 * if command class is null default classname will be used:COMMAND_PACKAGE+Command
 * Tag is any string parameter, transparently transported to command hanler
 */
public final class TextCommand {

	public final String commandClassName;
	public final String name; //unique key for all commands
	public final String tag;

	public TextCommand(String name, String className, String tag) {
		this.name = name.toLowerCase();
		this.commandClassName = className;
		this.tag = tag;
	}


	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof TextCommand)) {
			return false;
		}
		TextCommand c = (TextCommand) obj;
		return name.equals(c.name);
	}

	public int hashCode() {
		return (name != null ? name.hashCode() : 0);
	}
}

Site Stats

Snippets: 1791
Codebases: 571