Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / RevisionAwareXPath.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.model.api;
9
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression;
13 import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression.QualifiedBound;
14
15 /**
16  * Contains methods for getting data (concrete XPath) and metadata (is XPath absolute) from XPath instance.
17  */
18 // FIXME: 5.0.0: find a better name for this interface
19 public interface RevisionAwareXPath {
20     /**
21      * Returns <code>true</code> if the XPapth starts in root of Yang model, otherwise returns <code>false</code>.
22      *
23      * @return <code>true</code> if the XPapth starts in root of Yang model, otherwise returns <code>false</code>
24      */
25     boolean isAbsolute();
26
27     /**
28      * Returns the XPath formatted string as is defined in model. For example:
29      * /prefix:container/prefix:container::cond[when()=foo]/prefix:leaf
30      *
31      * @return the XPath formatted string as is defined in model.
32      */
33     @NonNull String getOriginalString();
34
35     @Beta
36     // FIXME: 5.0.0: integrate this interface into RevisionAwareXPath
37     interface WithExpression extends RevisionAwareXPath {
38         /**
39          * Return the {@link YangXPathExpression} of this XPath. The expression is required to be at least
40          * Qualified-bound.
41          *
42          * @return The location path
43          */
44         @NonNull QualifiedBound getXPathExpression();
45     }
46 }