diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-07-13 08:46:56 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-07-14 10:53:40 +0200 |
commit | 9e6835b79cda20c3614c6e76c64099ab64be2831 (patch) | |
tree | fd035c82d754119afc3e4d743ae4fb58f341f56a /v3po/api/src/main/java | |
parent | dddc1d221fae78677b5e269a4dad1f5ff409d0fe (diff) |
HONEYCOMB-49: VPP classifier model. Initial version
Change-Id: I8dbd22657c1cd1c9dfc45ca130015b5b3dbffee1
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/api/src/main/java')
2 files changed, 49 insertions, 0 deletions
diff --git a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/OpaqueIndexBuilder.java b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/OpaqueIndexBuilder.java new file mode 100644 index 000000000..01f088469 --- /dev/null +++ b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/OpaqueIndexBuilder.java @@ -0,0 +1,24 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603; + + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * 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 + * loss of user code. + * + */ +public class OpaqueIndexBuilder { + + public static OpaqueIndex getDefaultInstance(java.lang.String defaultValue) { + try { + final long value = Long.parseLong(defaultValue); // u32 value + return new OpaqueIndex(value); + } catch (NumberFormatException e) { + return new OpaqueIndex(VppNodeBuilder.getDefaultInstance(defaultValue)); + } + } + +} diff --git a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/VppNodeBuilder.java b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/VppNodeBuilder.java new file mode 100644 index 000000000..dd37bbe84 --- /dev/null +++ b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/vpp/classifier/rev150603/VppNodeBuilder.java @@ -0,0 +1,25 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603; + + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * 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 + * loss of user code. + * + */ +public class VppNodeBuilder { + + public static VppNode getDefaultInstance(java.lang.String defaultValue) { + if (PacketHandlingAction.Deny.toString().equalsIgnoreCase(defaultValue)) { + return new VppNode(PacketHandlingAction.Deny); + } else if (PacketHandlingAction.Permit.toString().equalsIgnoreCase(defaultValue)) { + return new VppNode(PacketHandlingAction.Permit); + } else { + throw new IllegalArgumentException(String.format("Could not parse VppNode: %s", defaultValue)); + } + } + +} |