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