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

com.sportradar.livedata.sdk.common.classes.EntityEnumHelper Maven / Gradle / Ivy

Go to download

Livedata SDK is a client library that enables easier integration with the Livedata XML feed. SDK exposes XML feed service interface in a more user-friendly way and isolates the client from having to do XML feed parsing, proper connection handling, error recovery, event queuing and dispatching. It also makes a client solution more stable and robust when it comes to feed handling, especially with the release of new and updated XML feed versions.

There is a newer version: 2.0.10
Show newest version
/***************************************************************
 * Copyright (c) 2013, Sportradar AG                           *
 ***************************************************************/

package com.sportradar.livedata.sdk.common.classes;

import com.sportradar.livedata.sdk.common.interfaces.EntityEnum;

/**
 * Helper class containing static helper methods for {@link EntityEnum} class.
 *
 * @author uros.bregar
 */
public class EntityEnumHelper {

    /**
     * Gets the enumeration member associated with the passed {@code literalValue}
     *
     * @param members      The members of the target enumeration.
     * @param literalValue The literal value to be compared with the literal value associated with the members
     * @param           The type of the enum
     * @return The member of the target enum or a null reference.
     */
    @SuppressWarnings("unchecked")
    public static  T getValueFromLiteralValue(EntityEnum[] members, String literalValue) {
        if (literalValue == null || literalValue.isEmpty()) {
            return null;
        }

        for (EntityEnum member : members) {
            if (member.isLiteralValueEqual(literalValue)) {
                return (T) member;
            }
        }
        return null;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy