2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowplugin.applications.frm;
11 import com.google.common.collect.ImmutableMap;
14 public enum ForwardingRulesProperty {
15 DISABLE_RECONCILIATION,
16 STALE_MARKING_ENABLED,
17 RECONCILIATION_RETRY_COUNT,
18 BUNDLE_BASED_RECONCILIATION_ENABLED;
21 private static final Map<String, ForwardingRulesProperty> KEY_VALUE_MAP;
24 * Get property type from property key
26 * @param key the property key
27 * @return the property type
29 public static ForwardingRulesProperty forValue(final String key) {
30 return KEY_VALUE_MAP.get(key);
34 final ForwardingRulesProperty[] values = values();
35 final ImmutableMap.Builder<String, ForwardingRulesProperty> builder = ImmutableMap.builder();
37 for (final ForwardingRulesProperty value : values) {
38 builder.put(value.toString(), value);
41 KEY_VALUE_MAP = builder.build();
45 * Converts enum name to property key
47 * @return the property key
50 public String toString() {
51 return this.name().toLowerCase().replace('_', '-');