org.mockftpserver.core.command
Class Command

java.lang.Object
  extended by org.mockftpserver.core.command.Command

public final class Command
extends Object

Represents a command received from an FTP client, containing a command name and parameters. Objects of this class are immutable.

Version:
$Revision: 77 $ - $Date: 2008-07-01 22:11:32 -0400 (Tue, 01 Jul 2008) $
Author:
Chris Mair

Constructor Summary
Command(String name, List parameters)
          Construct a new immutable instance with the specified command name and parameters
Command(String name, String[] parameters)
          Construct a new immutable instance with the specified command name and parameters
 
Method Summary
 boolean equals(Object obj)
           
 String getName()
           
 String getOptionalString(int index)
          Get the String value of the parameter at the specified index; return null if no parameter exists for the index.
 String getParameter(int index)
          Get the String value of the parameter at the specified index; return null if no parameter exists for the index
 String[] getParameters()
           
 String getRequiredParameter(int index)
          Get the String value of the parameter at the specified index
 int hashCode()
           
static String normalizeName(String name)
          Return the name, normalized to a common format - convert to upper case.
 String toString()
          Return the String representation of this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

public Command(String name,
               String[] parameters)
Construct a new immutable instance with the specified command name and parameters

Parameters:
name - - the command name; may not be null
parameters - - the command parameters; may be empty; may not be null

Command

public Command(String name,
               List parameters)
Construct a new immutable instance with the specified command name and parameters

Parameters:
name - - the command name; may not be null
parameters - - the command parameters; may be empty; may not be null
Method Detail

getName

public String getName()
Returns:
the name

getParameters

public String[] getParameters()
Returns:
the parameters

getRequiredParameter

public String getRequiredParameter(int index)
Get the String value of the parameter at the specified index

Parameters:
index - - the index
Returns:
the parameter value as a String
Throws:
AssertFailedException - if the parameter index is invalid or the value is not a valid String

getParameter

public String getParameter(int index)
Get the String value of the parameter at the specified index; return null if no parameter exists for the index

Parameters:
index - - the index
Returns:
the parameter value as a String, or null if this Command does not have a parameter for that index

getOptionalString

public String getOptionalString(int index)
Get the String value of the parameter at the specified index; return null if no parameter exists for the index. This is an alias for getParameter(int).

Parameters:
index - - the index
Returns:
the parameter value as a String, or null if this Command does not have a parameter for that index

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Return the String representation of this object

Overrides:
toString in class Object
See Also:
Object.toString()

normalizeName

public static String normalizeName(String name)
Return the name, normalized to a common format - convert to upper case.

Returns:
the name converted to upper case


Copyright © 2014. All rights reserved.