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
9 @import org.opendaylight.mdsal.binding.javav2.java.api.generator.renderers.EnumRenderer.writeEnumeration
10 @import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.formatDataForJavaDoc
11 @import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.wrapToDocumentation
12 @import org.opendaylight.mdsal.binding.javav2.model.api.Enumeration
13 @import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedType
15 @(genType: GeneratedType, importedName: String)
16 @if(genType != null) {
17 @{wrapToDocumentation(formatDataForJavaDoc(genType))}
18 public enum @{genType.getName} {
19 @{writeEnumeration(genType.asInstanceOf[Enumeration])}
23 private static final java.util.Map<java.lang.Integer, @{genType.getName}> VALUE_MAP;
26 final com.google.common.collect.ImmutableMap.Builder<java.lang.Integer, @{genType.getName}> b = com.google.common.collect.ImmutableMap.builder();
27 for (@{genType.getName} enumItem : @{genType.getName}.values())
29 b.put(enumItem.value, enumItem);
32 VALUE_MAP = b.build();
35 private @{genType.getName}(int value, @{importedName} name) {
41 * Returns the name of the enumeration item as it is specified in the input yang.
43 * @@return the name of the enumeration item as it is specified in the input yang
45 public @{importedName} getName() {
50 * @@return integer value
52 public int getIntValue() {
58 * @@return corresponding @{genType.getName} item
60 public static @{genType.getName} forValue(int valueArg) {
61 return VALUE_MAP.get(valueArg);