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

org.netbeans.modules.glassfish.common.GlassFishJvmMode Maven / Gradle / Ivy

There is a newer version: RELEASE240
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.netbeans.modules.glassfish.common;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.openide.util.NbBundle;

/**
 *
 * @author kratz
 */
public enum GlassFishJvmMode {

    ////////////////////////////////////////////////////////////////////////////
    // Enum values                                                            //
    ////////////////////////////////////////////////////////////////////////////

    /** Normal mode. */
    NORMAL,

    /** Debug mode. */
    DEBUG,

    /** Profiling mode. */
    PROFILE;

    ////////////////////////////////////////////////////////////////////////////
    // Class attributes                                                       //
    ////////////////////////////////////////////////////////////////////////////

    /** Local logger. */
    private static final Logger LOGGER
            = GlassFishLogger.get(GlassFishJvmMode.class);

    /** GlassFish version enumeration length. */
    public static final int length = GlassFishJvmMode.values().length;

    /**  A String representation of NORMAL value. */
    private static final String NORMAL_STR = "normalMode";

    /**  A String representation of DEBUG value. */
    private static final String DEBUG_STR = "debugMode";

    /**  A String representation of PROFILE value. */
    private static final String PROFILE_STR = "profileMode";

    /** Stored String values for backward String
     *  conversion. */
    private static final Map stringValuesMap
            = new HashMap(length);
    static {
        for (GlassFishJvmMode mode : GlassFishJvmMode.values()) {
            stringValuesMap.put(mode.toString().toUpperCase(), mode);
        }
    }
    ////////////////////////////////////////////////////////////////////////////
    // Static methods                                                         //
    ////////////////////////////////////////////////////////////////////////////
   
    /**
     * Returns a GlassFishJvmMode with a value represented by the
     * specified String. The GlassFishJvmMode returned
     * represents existing value only if specified String
     * matches any String returned by toString method.
     * Otherwise null value is returned.
     * 

* @param name Value containing GlassFishJvmMode * toString representation. * @return GlassFishJvmMode value represented * by String or null if value * was not recognized. */ public static GlassFishJvmMode toValue(final String name) { if (name != null) { return (stringValuesMap.get(name.toUpperCase())); } else { return null; } } //////////////////////////////////////////////////////////////////////////// // Methods // //////////////////////////////////////////////////////////////////////////// /** * Convert GlassFishJvmMode value to String. *

* @return A String representation of the value of this object. */ @Override public String toString() { switch (this) { case NORMAL: return NORMAL_STR; case DEBUG: return DEBUG_STR; case PROFILE: return PROFILE_STR; // This is unrecheable. Being here means this class does not handle // all possible values correctly. default: throw new IllegalStateException(NbBundle.getMessage( GlassFishJvmMode.class, "GlassFishJvmMode.toString.invalid")); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy