class ModeProcessor {

    static String processModeType(ModeType modeType, String input) {
        if (modeType == null || input == null || input.isEmpty()) {
            return input;
        }
        switch (modeType) {
            case FORWARD:
                // Change all backward slashes to forward slash.
                input = input.replace("\\", "/");
                break;
            case DOUBLE:
                // Add a slash to all back slashes.
                input = input.replace("\\", "\\\\");
                // Add a backslash before each colon.
                input = input.replace(":", "\\:");
                break;
            case POLICY:
                // Replace File.separator by ${/} for java.policy files
                input = input.replace(File.separator, "${/}");
                break;
            default:
                _logger.log(Level.WARNING, SLogger.NO_PROCESSOR_DEFINED, modeType.toString());
                break;
        }
        return input;
    }

}