2 * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.openflowplugin.applications.topology.lldp;
10 import com.google.common.collect.ImmutableMap;
11 import java.util.Locale;
14 public enum TopologyLLDPDiscoveryProperty {
16 TOPOLOGY_LLDP_INTERVAL,
17 TOPOLOGY_LLDP_EXPIRATION_INTERVAL;
19 private static final Map<String, TopologyLLDPDiscoveryProperty> KEY_VALUE_MAP;
22 * Get property type from property key.
24 * @param key the property key
25 * @return the property type
27 public static TopologyLLDPDiscoveryProperty forValue(final String key) {
28 return KEY_VALUE_MAP.get(key);
32 final TopologyLLDPDiscoveryProperty[] values = values();
33 final ImmutableMap.Builder<String, TopologyLLDPDiscoveryProperty> builder = ImmutableMap.builder();
35 for (final TopologyLLDPDiscoveryProperty value : values) {
36 builder.put(value.toString(), value);
39 KEY_VALUE_MAP = builder.build();
43 * Converts enum name to property key.
45 * @return the property key
48 public String toString() {
49 return this.name().toLowerCase(Locale.ROOT).replace('_', '-');