X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FLeafref.java;h=a143f5a629a90c8440b0bd850e927963bb19dbf9;hb=f9de1cd89c17888a2bd02486d5f7519f0b391bba;hp=21fdbde5fea6b7ede3d3ee8da8afa06e7e80c9d4;hpb=4ce0f6630bc576b97c8c9a08848aafb6e90a75b0;p=controller.git diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Leafref.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Leafref.java index 21fdbde5fe..a143f5a629 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Leafref.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Leafref.java @@ -1,13 +1,15 @@ /* - * Copyright (c) 2013 Cisco 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 - */ + * Copyright (c) 2013 Cisco 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.controller.yang.model.util; +import java.net.URI; import java.util.Collections; +import java.util.Date; import java.util.List; import org.opendaylight.controller.yang.common.QName; @@ -18,37 +20,58 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode; import org.opendaylight.controller.yang.model.api.type.LeafrefTypeDefinition; /** - * The default implementation of Instance Leafref Type Definition interface. + * The default implementation of Instance Leafref Type Definition + * interface. * * @see LeafrefTypeDefinition */ public class Leafref implements LeafrefTypeDefinition { private static final QName name = BaseTypes.constructQName("leafref"); - private static final String description = "The leafref type is used to reference a " + - "particular leaf instance in the data tree."; + private static final String description = "The leafref type is used to reference a " + + "particular leaf instance in the data tree."; private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.9"; - private final SchemaPath path = BaseTypes.schemaPath(name); + private final SchemaPath path; private final RevisionAwareXPath xpath; private final String units = ""; + private final LeafrefTypeDefinition baseType; + + private Leafref(final RevisionAwareXPath xpath) { + this.xpath = xpath; + this.path = BaseTypes.schemaPath(name); + this.baseType = this; + } + + public Leafref(final List actualPath, final URI namespace, + final Date revision, final RevisionAwareXPath xpath) { + super(); + this.path = BaseTypes.schemaPath(actualPath, namespace, revision); + this.xpath = xpath; + baseType = new Leafref(xpath); + } - public Leafref(RevisionAwareXPath xpath) { + public Leafref(final List actualPath, final URI namespace, + final Date revision, final LeafrefTypeDefinition baseType, + final RevisionAwareXPath xpath) { super(); + this.path = BaseTypes.schemaPath(actualPath, namespace, revision); this.xpath = xpath; + this.baseType = baseType; } /* * (non-Javadoc) - * - * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType() + * + * @see + * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType() */ @Override public LeafrefTypeDefinition getBaseType() { - return this; + return baseType; } /* * (non-Javadoc) - * + * * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits() */ @Override @@ -58,8 +81,10 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * - * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue() + * + * @see + * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue + * () */ @Override public Object getDefaultValue() { @@ -68,7 +93,7 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * + * * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName() */ @Override @@ -78,7 +103,7 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * + * * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath() */ @Override @@ -88,8 +113,9 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * - * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription() + * + * @see + * org.opendaylight.controller.yang.model.api.SchemaNode#getDescription() */ @Override public String getDescription() { @@ -98,7 +124,7 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * + * * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference() */ @Override @@ -108,7 +134,7 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * + * * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus() */ @Override @@ -118,8 +144,10 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * - * @see org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes() + * + * @see + * org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes + * () */ @Override public List getUnknownSchemaNodes() { @@ -128,9 +156,10 @@ public class Leafref implements LeafrefTypeDefinition { /* * (non-Javadoc) - * + * * @see - * org.opendaylight.controller.yang.model.api.type.LeafrefTypeDefinition#getPathStatement() + * org.opendaylight.controller.yang.model.api.type.LeafrefTypeDefinition + * #getPathStatement() */ @Override public RevisionAwareXPath getPathStatement() {