com.github.croesch.micro_debug.argument
Class AArgument

java.lang.Object
  extended by com.github.croesch.micro_debug.argument.AArgument
Direct Known Subclasses:
AError, Help, OutputFile, UnbufferedOutput, Version

public abstract class AArgument
extends java.lang.Object

Enumeration of all possible command line arguments for the debugger.

Since:
Date: Aug 13, 2011
Author:
croesch

Constructor Summary
protected AArgument()
          Constructs a new argument with its name as long argument and its first letter as short argument.
protected AArgument(int nop)
          Constructs a new argument with its name as long argument and its first letter as short argument.
 
Method Summary
static java.util.Map<AArgument,java.lang.String[]> createArgumentList(java.lang.String[] args)
          Converts a given array of Strings into a Map that contains an entry for each valid AArgument and the possible parameters belonging to it.
abstract  boolean execute(java.lang.String... params)
          Executes commands that result in the specific argument.
protected  boolean matches(java.lang.String argStr)
          Returns whether this argument can be called with the given String.
protected abstract  java.lang.String name()
          Returns the name of this argument containing only lower case characters and -.
static AArgument of(java.lang.String s)
          Returns the AArgument that matches with the given String.
static void releaseAllResources()
          Releases important references.
static java.util.List<AArgument> values()
          Returns the list of arguments that are available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AArgument

protected AArgument()
Constructs a new argument with its name as long argument and its first letter as short argument. For example ARGUMENT will result in:
Note: A _ in the name will be translated to a -.
This argument will require no parameters.

Since:
Date: Aug 13, 2011
See Also:
AArgument(int)

AArgument

protected AArgument(int nop)
Constructs a new argument with its name as long argument and its first letter as short argument. For example ARGUMENT will result in:
Note: A _ in the name will be translated to a -.
This argument will require the passed number of parameters.

Parameters:
nop - the number of parameters this argument requires
Since:
Date: Aug 17, 2011
See Also:
AArgument()
Method Detail

matches

protected final boolean matches(java.lang.String argStr)
Returns whether this argument can be called with the given String. Will return false, if the given String is null or if the AArgument is a pseudo-argument that cannot be called.

Parameters:
argStr - the String to test if it's a possible call for this argument
Returns:
true, if this argument can be called with the given String.
For example --argument will return true for the argument ARGUMENT.
Since:
Date: Aug 13, 2011

of

@Nullable
public static AArgument of(java.lang.String s)
Returns the AArgument that matches with the given String.

Parameters:
s - the String that is able to call the returned AArgument.
Returns:
the AArgument that matches the given String, or null if no argument can be called with the given String.
Since:
Date: Aug 13, 2011
See Also:
matches(String)

createArgumentList

@NotNull
public static java.util.Map<AArgument,java.lang.String[]> createArgumentList(java.lang.String[] args)
Converts a given array of Strings into a Map that contains an entry for each valid AArgument and the possible parameters belonging to it.

Parameters:
args - the array of Strings
Returns:
the Map that contains pairs of AArguments and arrays of strings that contain all parameters for that argument.
Since:
Date: Aug 17, 2011

execute

public abstract boolean execute(java.lang.String... params)
Executes commands that result in the specific argument.

Parameters:
params - the parameters of that argument, in case of the pseudo arguments (prefix ERROR_) this array contains the causes for the error.
Returns:
false, if the argument enforces the application to stop
Since:
Date: Dec 2, 2011

name

@NotNull
protected abstract java.lang.String name()
Returns the name of this argument containing only lower case characters and -.

Returns:
the name of this argument.
Since:
Date: Feb 28, 2012

releaseAllResources

public static void releaseAllResources()
Releases important references.

Since:
Date: Feb 15, 2012

values

@NotNull
public static java.util.List<AArgument> values()
Returns the list of arguments that are available.

Returns:
the list of arguments that are available.
Since:
Date: Feb 28, 2012


Copyright © 2012. All Rights Reserved.