Package org.cristian.fundamentum
Class ArgumentVector
- java.lang.Object
-
- org.cristian.fundamentum.ArgumentVector
-
- All Implemented Interfaces:
java.lang.Runnable
public abstract class ArgumentVector extends java.lang.Object implements java.lang.Runnable
This class provides with a easy-to-use abstract class for creating CLI programs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ArgumentVector.Alias
This annotation can be used to give an alias to a command or a parameter.static interface
ArgumentVector.Command
This annotation is used to declare a class method as a command.static interface
ArgumentVector.Copyright
This annotation can be used to give some information about the program's class copyright.static interface
ArgumentVector.Description
This annotation can be used to give a meaningful description to a command, parameter or the program's class.static interface
ArgumentVector.Name
This annotation can be used to give a name to the program's class.static interface
ArgumentVector.Parameter
This annotation is used to declare a class field as a parameter.
-
Constructor Summary
Constructors Constructor Description ArgumentVector(java.lang.String[] RawArgumentVector)
Initializes the CLI program class with the supplied raw argument vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
errorHandler(java.lang.String Error, int Code)
Override this method if you want to handle errors by yourself.java.lang.String
getHelp()
Generate a help text for this CLI program.void
guiLauncher()
Override this method if you want to launch a GUI interface like a Swing program.void
noArgumentHandler()
Override this method if you want to handle a no-argument situation by yourself.void
noCommandHandler()
Override this method if you want to handle no-command situations by yourself.void
run()
Execute this CLI program.
-
-
-
Constructor Detail
-
ArgumentVector
public ArgumentVector(java.lang.String[] RawArgumentVector) throws java.lang.IllegalArgumentException
Initializes the CLI program class with the supplied raw argument vector.- Parameters:
RawArgumentVector
- The String array that you get in a main class's main method.- Throws:
java.lang.IllegalArgumentException
- If something is wrong with any command or parameter, this is raised.- See Also:
run()
-
-
Method Detail
-
run
public void run()
Execute this CLI program.- Specified by:
run
in interfacejava.lang.Runnable
- Since:
- 1.0.0
-
errorHandler
public void errorHandler(java.lang.String Error, int Code)
Override this method if you want to handle errors by yourself.- Parameters:
Error
- Error text passed to the method.Code
- Exit code for the program.
-
noCommandHandler
public void noCommandHandler()
Override this method if you want to handle no-command situations by yourself.
-
noArgumentHandler
public void noArgumentHandler()
Override this method if you want to handle a no-argument situation by yourself.
-
guiLauncher
public void guiLauncher()
Override this method if you want to launch a GUI interface like a Swing program. NOTE: By default, this method is called by the noArgumentHandler method, if you override that method, be sure to call this method if you overrided that method too.
-
getHelp
public java.lang.String getHelp()
Generate a help text for this CLI program.- Returns:
- Help text.
- Since:
- 1.0.0
-
-