Runtime tool utilities
Sample helpers class to build java standalone tools
Check if all the parameters needed are set. If not a ConfigRuntimeException with code
try {
    ParamHolder holder = ParamHolder.newAndHolder(
            ParamHolder.newHolder("arg1"),
            ParamHolder.newOrHolder("arg2", "arg3"));
    if ( ArgHelper.checkAllRequiredThrowRuntimeEx(params, holder) ) {
        // code
    }
} catch (ConfigRuntimeException e) {
    if ( e.getCode() == MainHelper.FAIL_MISSING_REQUIRED_PARAM ) {
        log.info( "Missing parameters : {}", e.getMessage() );    
    } else {
        // code
    }
}Handle main method
public static void main( String[] args ) {
    MainHelper.handleMain( () -> {
        // code    
    } ); 
}By default any exception will be evaluated as follow in an exit code
public static int evaluateExitCode(Throwable ex ) {
    if ( ex instanceof CodeEx) {
        CodeEx codeEx = (CodeEx) ex;
        return codeEx.getCode();
    } else if ( ex != null ) {
        return FAIL_DEFAULT;
    } else {
        return OK_DEFAULT;
    }
}Behaviours may be customized, for instance this way exit code will be printed with no System.exit() call :
MainHelper.setDefaultExitAction( ec -> log.warn( "Exit : {}", ec ) );