All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.croesch.micro_debug.parser.DebugModeParser Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2011-2012  Christian Roesch
 * 
 * This file is part of micro-debug.
 * 
 * micro-debug is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * micro-debug is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with micro-debug.  If not, see .
 */
package com.github.croesch.micro_debug.parser;

import java.util.Locale;

import com.github.croesch.micro_debug.annotation.Nullable;
import com.github.croesch.micro_debug.datatypes.DebugMode;

/**
 * Parses debugging mode from {@link String}s.
 * 
 * @author croesch
 * @since Date: Sep 10, 2012
 */
public final class DebugModeParser implements IParser {

  /** {@inheritDoc} */
  @Nullable
  public DebugMode parse(final String toParse) {
    if (toParse == null) {
      return null;
    }

    try {
      return DebugMode.valueOf(toParse.toUpperCase(Locale.GERMAN));
    } catch (final IllegalArgumentException e) {
      return null;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy