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

cz.mmsparams.api.enums.smsc.NumberingPlanIndicator Maven / Gradle / Ivy

The newest version!
/*
 * Licensed 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 cz.mmsparams.api.enums.smsc;

import java.io.Serializable;

import cz.mmsparams.api.constants.smsc.SMSCConstant;
import cz.mmsparams.api.logging.APILoggerFactory;
import cz.mmsparams.api.logging.ApiLogFacade;
import cz.mmsparams.api.logging.ILogger;

/**
 * This enum is defined Numbering Plan Indicator.
 *
 * @author uudashr
 * @version 1.0
 * @since 1.0
 */
public enum NumberingPlanIndicator implements Serializable
{
    NPI_UNKNOWN(SMSCConstant.NPI_UNKNOWN),
    NPI_E164(SMSCConstant.NPI_E164),
    NPI_ISDN(SMSCConstant.NPI_ISDN),
    NPI_X121(SMSCConstant.NPI_X121),
    NPI_TELEX(SMSCConstant.NPI_TELEX),
    NPI_LAND_MOBILE(SMSCConstant.NPI_LAND_MOBILE),
    NPI_NATIONAL(SMSCConstant.NPI_NATIONAL),
    NPI_PRIVATE(SMSCConstant.NPI_PRIVATE),
    NPI_ERMES(SMSCConstant.NPI_ERMES),
    NPI_INTERNET(SMSCConstant.NPI_INTERNET);

    private byte value;
    private static final ILogger LOGGER = APILoggerFactory.getLogger(NumberingPlanIndicator.class);

    NumberingPlanIndicator(byte value)
    {
        this.value = value;
    }

    /**
     * Return the value of NPI.
     *
     * @return the value of NPI.
     */
    public byte value()
    {
        return value;
    }

    /**
     * Get the associated NumberingPlanIndicator by it's value.
     *
     * @param value is the value.
     * @return the associated enum const for specified value.
     * @throws IllegalArgumentException if there is no enum const associated
     *                                  with specified value.
     */
    public static NumberingPlanIndicator valueOf(byte value)
            throws IllegalArgumentException
    {
        for (NumberingPlanIndicator val : values())
        {
            if (val.value == value)
                return val;
        }

        ApiLogFacade.logWarning(LOGGER, "No enum const NumberingPlanIndicator with value " + value);
        return NumberingPlanIndicator.NPI_UNKNOWN;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy