Class CommandParser

java.lang.Object
com.github.mafelp.utils.CommandParser

public class CommandParser
extends java.lang.Object
Class to create new Commands
  • Constructor Summary

    Constructors
    Constructor Description
    CommandParser()  
  • Method Summary

    Modifier and Type Method Description
    static Command parseFromArray​(java.lang.String[] inputCommandArray)
    method for parsing commands and arguments into the command class.
    static Command parseFromString​(java.lang.String commandArgumentString)
    method for parsing commands and arguments into the command class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CommandParser

      public CommandParser()
  • Method Details

    • parseFromString

      public static Command parseFromString​(java.lang.String commandArgumentString) throws CommandNotFinishedException, NoCommandGivenException
      method for parsing commands and arguments into the command class.
      Parameters:
      commandArgumentString - command and arguments contained in a string.
      Returns:
      the command parsed from the string
      Throws:
      CommandNotFinishedException - if the command has an uneven number of quotation marks.
      NoCommandGivenException - if the input is null.
    • parseFromArray

      public static Command parseFromArray​(java.lang.String[] inputCommandArray) throws NoCommandGivenException
      method for parsing commands and arguments into the command class.
      Parameters:
      inputCommandArray - the array to parse the commands from
      Returns:
      the built command
      Throws:
      NoCommandGivenException