summaryrefslogtreecommitdiffstats
path: root/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2023-01-05 09:31:25 -0500
committerDan Timoney <dtimoney@att.com>2023-01-05 09:31:25 -0500
commitd4d6fbd430eb502cce6cb01a667ec799d487a510 (patch)
treeaea94837cd313f27f68e625d2b8277960fdf7af6 /netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
parentd0508aaeb7af3f29095d1d0ef7dbf69af18f0d99 (diff)
Seed code for biermann restconf
Seed initial code from OpenDaylight netconf project for Biermann draft version of restconf API Issue-ID: CCSDK-3783 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: I8a1ad2050ee7addbb480f01bd448922803bff31f
Diffstat (limited to 'netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java')
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
new file mode 100644
index 0000000..d09646a
--- /dev/null
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import java.util.regex.Pattern;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+
+/**
+**/
+public class RevisionBuilder {
+
+ /**
+ * Defines the pattern for revisions. NOTE: This pattern will likely be
+ * updated in future versions of the ietf and should be adjusted accordingly
+ */
+ private static final Pattern REVISION_PATTERN = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
+
+ public static Revision getDefaultInstance(String defaultValue) {
+
+ if (defaultValue != null) {
+ if (REVISION_PATTERN.matcher(defaultValue).matches()) {
+ RevisionIdentifier id = new RevisionIdentifier(defaultValue);
+ return new Revision(id);
+ }
+ if (defaultValue.isEmpty()) {
+ return new Revision(defaultValue);
+ }
+ }
+
+ throw new IllegalArgumentException("Cannot create Revision from " + defaultValue
+ + ". Default value does not match pattern " + REVISION_PATTERN.pattern()
+ + " or empty string.");
+ }
+
+}