org.hyphenType.lexerparser
Class LexerParser<T extends Options<?>>

java.lang.Object
  extended by org.hyphenType.lexerparser.LexerParser<T>
Type Parameters:
T -

public class LexerParser<T extends Options<?>>
extends Object

A LexerParser is an object that can parse an array of strings and create a list of tokens from it. To do so, the LexerParser's constructor performs a deep analysis on the options interface.

Therefore, invoking the LexerParser constructor can also be used to validate the options interface.

Author:
Aurelio Akira M. Matsui

Constructor Summary
LexerParser(Class<T> optionsInterfaceClass)
           
LexerParser(Class<T> optionsInterfaceClass, boolean loadFromResourceBundle)
           
 
Method Summary
 ArgumentsObject getArgsObject()
           
 Class<T> getOptionsInterface()
           
 List<StructureOption> getParsedOptions()
           
 List<StructureSimpleArgument> getSimpleArguments()
           
 List<LexToken> lexArguments(String... arguments)
          Classifies arguments and creates tokens based on it.
 StructureSimpleArgument searchArgument(String name)
           
 StructureElement searchElement(Method method)
           
 StructureOption searchOption(String name)
           
 String searchOptionPrefixing(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LexerParser

public LexerParser(Class<T> optionsInterfaceClass)
            throws InvalidOptionsInterfaceException
Parameters:
optionsInterfaceClass -
Throws:
InvalidOptionsInterfaceException

LexerParser

public LexerParser(Class<T> optionsInterfaceClass,
                   boolean loadFromResourceBundle)
            throws InvalidOptionsInterfaceException
Parameters:
optionsInterfaceClass -
loadFromResourceBundle -
Throws:
InvalidOptionsInterfaceException
Method Detail

getArgsObject

public final ArgumentsObject getArgsObject()
Returns:
TODO

getOptionsInterface

public final Class<T> getOptionsInterface()
Returns:
TODO

lexArguments

public final List<LexToken> lexArguments(String... arguments)
Classifies arguments and creates tokens based on it.
  1. LexOption (as "version" in "-version")
  2. LexOptionValue (as "12" in "-x=12")
  3. LexOptionMapValue (as "a=b" in "-xa=b")
  4. LexUnknown (as "aa" and "bb" in "-x aa bb")

Parameters:
arguments - The arguments to be converted into lexer tokens.
Returns:
A list of tokens in the order they appear in the arguments.

getParsedOptions

public final List<StructureOption> getParsedOptions()
Returns:
TODO

getSimpleArguments

public final List<StructureSimpleArgument> getSimpleArguments()
Returns:
TODO

searchOption

public final StructureOption searchOption(String name)
Parameters:
name - TODO
Returns:
TODO

searchOptionPrefixing

public final String searchOptionPrefixing(String name)
Parameters:
name - TODO
Returns:
TODO

searchArgument

public final StructureSimpleArgument searchArgument(String name)
Parameters:
name - TODO
Returns:
TODO

searchElement

public final StructureElement searchElement(Method method)
Parameters:
method - TODO
Returns:
TODO


Copyright © 2013. All Rights Reserved.