diff options
author | 2016-07-13 08:46:56 +0200 | |
---|---|---|
committer | 2016-07-14 10:53:40 +0200 | |
commit | 5fc7ae574e71ac326521d3fe8860f38604bedf53 (patch) | |
tree | 8ffcd6c90b0359112e3b75adf9b34e6f4fa6f8b3 /v3po/api/src/main/java/org/opendaylight/yang | |
parent | 632055ae0e29d16b831519b095b5c34dd430e19c (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/org/opendaylight/yang')
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)); + } + } + +} |