2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.restful.utils;
11 * Common util class for resolve enum from String.
14 public final class ResolveEnumUtil {
16 private ResolveEnumUtil() {
17 throw new UnsupportedOperationException("Util class");
21 * Resolve specific type of enum by value.
29 public static <T> T resolveEnum(final Class<T> clazz, final String value) {
30 for (final T t : clazz.getEnumConstants()) {
31 if (((Enum<?>) t).name().equals(value)) {