*/
package org.opendaylight.yangtools.yang.model.util;
+import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
*/
public final class Leafref implements LeafrefTypeDefinition {
private static final QName NAME = BaseTypes.constructQName("leafref");
- private static final SchemaPath PATH = BaseTypes.schemaPath(NAME);
+ private static final SchemaPath PATH = SchemaPath.create(true, NAME);
private static final String DESCRIPTION = "The leafref type is used to reference a particular leaf instance in the data tree.";
private static final String REF = "https://tools.ietf.org/html/rfc6020#section-9.9";
private final RevisionAwareXPath xpath;
+ private final SchemaPath path;
+ @Deprecated
public Leafref(final RevisionAwareXPath xpath) {
- this.xpath = xpath;
+ this(PATH,xpath);
+
+ }
+
+ private Leafref(final SchemaPath path, final RevisionAwareXPath target) {
+ this.path = Preconditions.checkNotNull(path,"path must be specified");
+ this.xpath = Preconditions.checkNotNull(target,"target must not be null.");
+ }
+
+ public static Leafref create(final SchemaPath path,final RevisionAwareXPath target) {
+ return new Leafref(path,target);
}
@Override
@Override
public SchemaPath getPath() {
- return PATH;
+ return path;
}
@Override
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}