98105ac775249c7b7006f01592cb709eccde09c0
[mdsal.git] / binding / mdsal-binding-test-model / src / main / java / org / opendaylight / yang / gen / v1 / urn / opendaylight / params / xml / ns / yang / mdsal / test / bug / _6006 / rev160607 / UnionTypeBuilder.java
1 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.bug._6006.rev160607;
2
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;
6
7 /**
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).
10  *
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
13  * loss of user code.
14  *
15  */
16 public class UnionTypeBuilder {
17
18     public static UnionType getDefaultInstance(java.lang.String defaultValue) {
19         Class<? extends IdentBase> identityref = null;
20         if (defaultValue.equals("IdentOne")) {
21             return new UnionType(IdentOne.class);
22         }
23         if (defaultValue.equals("IdentTwo")) {
24             return new UnionType(IdentTwo.class);
25         }
26         throw new IllegalArgumentException("Unknown UnionType string " + defaultValue);
27     }
28
29 }