Add missing license notice
[neutron.git] / model / src / main / java / org / opendaylight / yang / gen / v1 / urn / opendaylight / neutron / secgroups / rev150712 / SecurityRuleAttributesProtocolBuilder.java
1 /*
2  * Copyright (C) 2018 Intel Corp.
3  *
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
7  */
8 package org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.NeutronUtils;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes.Protocol;
13
14
15 /**
16  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
17  * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
18  *
19  * The reason behind putting it under src/main/java is:
20  * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
21  * loss of user code.
22  *
23  */
24 public class SecurityRuleAttributesProtocolBuilder {
25
26     public static Protocol getDefaultInstance(java.lang.String defaultValue) {
27         Class<? extends ProtocolBase> protocol =
28             NeutronUtils.ProtocolMapper.get(defaultValue);
29         if (protocol != null) {
30             return new Protocol(protocol);
31         }
32         Short protocolShort = Short.parseShort(defaultValue);
33         return new Protocol(protocolShort);
34     }
35
36 }