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

com.global.api.utils.EnumUtils Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.utils;

import com.global.api.entities.enums.*;

public class EnumUtils {
    public static  & IByteConstant> boolean isDefined(Class valueType, byte value){
        return parse(valueType, value) != null;
    }

    public static  & IByteConstant> V parse(Class valueType, byte value) {
        ReverseByteEnumMap map = new ReverseByteEnumMap(valueType);
        return map.get(value);
    }

    public static  & IStringConstant> V parse(Class valueType, String value) {
        ReverseStringEnumMap map = new ReverseStringEnumMap(valueType);
        return map.get(value);
    }

    public static  & INumericConstant> V parse(Class valueType, int value) {
        ReverseIntEnumMap map = new ReverseIntEnumMap(valueType);
        return map.get(value);
    }

    public static String getMapping(Target target, IMappedConstant value) {
        return (value != null) ? value.getValue(target) : null;
    }

    public static String mapDigitalWalletType(Target target, MobilePaymentMethodType type) {
        if (target == Target.GP_API) {
            switch (type) {
                case APPLEPAY:
                    return EncyptedMobileType.APPLE_PAY.getValue();
                case GOOGLEPAY:
                    return EncyptedMobileType.GOOGLE_PAY.getValue();
                case CLICK_TO_PAY:
                    return EncyptedMobileType.CLICK_TO_PAY.getValue();
            }
        }
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy