com.realtime.crossfire.jxclient.gui.commands
Class GUICommandFactory

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.commands.GUICommandFactory

public class GUICommandFactory
extends java.lang.Object

Factory for creating GUICommand instances from string representation.


Field Summary
private static java.util.regex.Pattern PATTERN_ENCODE
          Pattern matching lines that need a TRAILING_ESCAPE appended.
private static java.lang.String TRAILING_ESCAPE
          Character appended to lines ending with whitespace.
 
Constructor Summary
private GUICommandFactory()
          Private constructor to prevent instantiation.
 
Method Summary
static GUICommand createCommand(java.lang.String commandString, CommandCallback commandCallback, Commands commands, Macros macros)
          Create a new GUICommand instance from string representation.
static GUICommand createCommandDecode(java.lang.String encodedCommandString, CommandCallback commandCallback, Commands commands, Macros macros)
          Create a new GUICommand instance from string representation.
private static java.lang.String decode(java.lang.String command)
          Decodes a key binding if necessary.
static java.lang.String encode(java.lang.String command)
          Encodes a key binding if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_ENCODE

@NotNull
private static final java.util.regex.Pattern PATTERN_ENCODE
Pattern matching lines that need a TRAILING_ESCAPE appended.


TRAILING_ESCAPE

@NotNull
private static final java.lang.String TRAILING_ESCAPE
Character appended to lines ending with whitespace.

See Also:
Constant Field Values
Constructor Detail

GUICommandFactory

private GUICommandFactory()
Private constructor to prevent instantiation.

Method Detail

createCommand

@NotNull
public static GUICommand createCommand(@NotNull
                                               java.lang.String commandString,
                                               @NotNull
                                               CommandCallback commandCallback,
                                               @NotNull
                                               Commands commands,
                                               @NotNull
                                               Macros macros)
Create a new GUICommand instance from string representation.

Parameters:
commandString - the command string representation
commandCallback - the command callback to use
commands - the commands instance to use
macros - the macros instance to use
Returns:
the new command instance

createCommandDecode

public static GUICommand createCommandDecode(@NotNull
                                             java.lang.String encodedCommandString,
                                             @NotNull
                                             CommandCallback commandCallback,
                                             @NotNull
                                             Commands commands,
                                             @NotNull
                                             Macros macros)
Create a new GUICommand instance from string representation.

Parameters:
encodedCommandString - the command string representation
commandCallback - the command callback to use
commands - the commands instance to use
macros - the macros instance to use
Returns:
the new command instance

decode

@NotNull
private static java.lang.String decode(@NotNull
                                               java.lang.String command)
Decodes a key binding if necessary.

Parameters:
command - the key binding
Returns:
the decoded key binding

encode

@NotNull
public static java.lang.String encode(@NotNull
                                              java.lang.String command)
Encodes a key binding if necessary.

Parameters:
command - the key binding
Returns:
the encoded key binding