1 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.bug._6006.rev160607;
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.bug._6006.rev160607.IdentBase;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.bug._6006.rev160607.IdentOne;
5 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.bug._6006.rev160607.IdentTwo;
8 * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
9 * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
11 * The reason behind putting it under src/main/java is:
12 * 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
16 public class UnionTypeBuilder {
18 public static UnionType getDefaultInstance(java.lang.String defaultValue) {
19 if (defaultValue.equals("IdentOne")) {
20 return new UnionType(IdentOne.class);
22 if (defaultValue.equals("IdentTwo")) {
23 return new UnionType(IdentTwo.class);
27 return new UnionType(Short.valueOf(defaultValue));
28 } catch(NumberFormatException e) {
32 throw new IllegalArgumentException("Unknown UnionType string " + defaultValue);