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;
12 import java.util.Locale;
15 public enum ForwardingRulesProperty {
16 DISABLE_RECONCILIATION,
17 STALE_MARKING_ENABLED,
18 RECONCILIATION_RETRY_COUNT,
19 BUNDLE_BASED_RECONCILIATION_ENABLED;
22 private static final Map<String, ForwardingRulesProperty> KEY_VALUE_MAP;
25 * Get property type from property key.
27 * @param key the property key
28 * @return the property type
30 public static ForwardingRulesProperty forValue(final String key) {
31 return KEY_VALUE_MAP.get(key);
35 final ForwardingRulesProperty[] values = values();
36 final ImmutableMap.Builder<String, ForwardingRulesProperty> builder = ImmutableMap.builder();
38 for (final ForwardingRulesProperty value : values) {
39 builder.put(value.toString(), value);
42 KEY_VALUE_MAP = builder.build();
46 * Converts enum name to property key.
48 * @return the property key
51 public String toString() {
52 return this.name().toLowerCase(Locale.ROOT).replace('_', '-');