net.sf.jpkgmk.prototype
Class CommandType

java.lang.Object
  extended by net.sf.jpkgmk.prototype.CommandType
All Implemented Interfaces:
java.io.Serializable

public class CommandType
extends java.lang.Object
implements java.io.Serializable

Typesafe enumeration CommandType

Since:
1.0
Version:
$Revision: 2 $ $Date: 2008-08-20 21:14:19 +0200 (Mi, 20 Aug 2008) $
Author:
gommma (gommma AT users.sourceforge.net), Last changed by: $Author: gommma $
See Also:
Serialized Form

Nested Class Summary
static class CommandType.CommandTypeDefaultParser
           
static class CommandType.CommandTypeIncludeParser
           
static class CommandType.CommandTypeParamValueParser
           
static interface CommandType.CommandTypeParser
           
static class CommandType.CommandTypeSearchParser
           
 
Field Summary
static CommandType DEFAULT
           
static CommandType INCLUDE
           
static CommandType PARAM_VALUE
           
static CommandType SEARCH
           
static CommandType[] VALUES
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static CommandType findType(int searchedId)
          Resolves the command type by the surrogate id
static CommandType findTypeByName(java.lang.String commandName)
          Resolves the command type by the given name.
 java.lang.String getIdName()
           
 CommandType.CommandTypeParser getParser()
           
 int hashCode()
           
 boolean matches(java.lang.String commandName)
          Returns true if the given command name matches this command.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEARCH

public static final CommandType SEARCH

INCLUDE

public static final CommandType INCLUDE

DEFAULT

public static final CommandType DEFAULT

PARAM_VALUE

public static final CommandType PARAM_VALUE

VALUES

public static CommandType[] VALUES
Method Detail

getIdName

public java.lang.String getIdName()
Returns:
Returns the unique name of this command type to be used for writing it into the prototype file

matches

public boolean matches(java.lang.String commandName)
Returns true if the given command name matches this command.

Parameters:
commandName -
Returns:

getParser

public CommandType.CommandTypeParser getParser()

findType

public static CommandType findType(int searchedId)
Resolves the command type by the surrogate id

Parameters:
searchedId -
Returns:
Returns the command for the given ID or null if it was not found.

findTypeByName

public static CommandType findTypeByName(java.lang.String commandName)
Resolves the command type by the given name. If no command key matches we assume that it is a "Param=value" command and return PARAM_VALUE.

Parameters:
commandName - The name of the command to be found, e.g. "search"
Returns:
The found command or PARAM_VALUE if it could not be resolved.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2008. All Rights Reserved.