ch.sahits.codegen.util
Class ConsoleInputValidator

java.lang.Object
  extended by ch.sahits.codegen.util.ConsoleInputValidator

public abstract class ConsoleInputValidator
extends java.lang.Object

Helper to validate console input based on enumerations

Since:
2.1.0
Author:
Andi Hotz, Sathis GmbH

Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> arguments
           
 
Constructor Summary
protected ConsoleInputValidator(java.lang.String[] args, boolean obligatory)
          Initialize the arguments from the array list
 
Method Summary
protected abstract  java.lang.Enum<?> getValueFromEnum(java.lang.String key)
          Retrieve the Enumeration for the value
protected  boolean innerValidate(int paramCount)
          Validate parameters against an enumeration, common code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arguments

protected final java.util.Map<java.lang.String,java.lang.String> arguments
Constructor Detail

ConsoleInputValidator

protected ConsoleInputValidator(java.lang.String[] args,
                                boolean obligatory)
Initialize the arguments from the array list

Parameters:
args - even number of arguments
obligatory - flag indicating that all parameters are obligatory
Throws:
java.lang.IllegalArgumentException - if the numer of arguments is uneven
Method Detail

innerValidate

protected boolean innerValidate(int paramCount)
Validate parameters against an enumeration, common code

Parameters:
paramCount - number of elements in the enumeration
Returns:
true if the parameters are valid

getValueFromEnum

protected abstract java.lang.Enum<?> getValueFromEnum(java.lang.String key)
Retrieve the Enumeration for the value

Parameters:
key - for the value to be retrieved
Returns:
value for the key