ninja-core/src/main/java/ninja/utils/NinjaModeHelper.java
public static Optional<NinjaMode> determineModeFromSystemProperties() {
        
        NinjaMode ninjaMode = null;
        
        // Get mode possibly set via a system property
        String modeFromGetSystemProperty = System
                .getProperty(NinjaConstant.MODE_KEY_NAME);
        
        // If the user specified a mode we set the mode accordingly:
        if (modeFromGetSystemProperty != null) {

            if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_TEST)) {
                
                ninjaMode = NinjaMode.test;
                
            } else if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_DEV)) {
                
                ninjaMode = NinjaMode.dev;
                
            } else if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_PROD)) {
                
                ninjaMode = NinjaMode.prod;
                
            }

        }
        
        return Optional.ofNullable(ninjaMode);
        
    }
public static Optional<NinjaMode> determineModeFromSystemProperties() {
        
        NinjaMode ninjaMode = null;
        
        // Get mode possibly set via a system property
        String modeFromGetSystemProperty = System
                .getProperty(NinjaConstant.MODE_KEY_NAME);
        
        // If the user specified a mode we set the mode accordingly:
        if (modeFromGetSystemProperty != null) {

            if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_TEST)) {
                
                ninjaMode = NinjaMode.test;
                
            } else if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_DEV)) {
                
                ninjaMode = NinjaMode.dev;
                
            } else if (modeFromGetSystemProperty.equals(NinjaConstant.MODE_PROD)) {
                
                ninjaMode = NinjaMode.prod;
                
            }

        }
        
        return Optional.ofNullable(ninjaMode);
        
    }
returns an empty Optional<NinjaMode> if no mode is set. Or the valid mode
set via a System Property called "ninja.mode".

E.g. under mvn you can use mvn ... -Dninja.mode=prod or so. Valid values
for ninja.mode are "prod", "dev", "test".

@return The valid mode set via a System Property called "ninja.mode"
or Optional absent if we cannot get one.