Class NamespaceBehaviour<K,V>
java.lang.Object
org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour<K,V>
- Type Parameters:
K
- Key typeV
- Value type
Definition / implementation of specific Identifier Namespace behaviour. A namespace behaviour is built on top
of a tree of
NamespaceStorage
which represents local context of one of types defined in NamespaceStorage.StorageType
.
For common behaviour models please use static factories global(ParserNamespace)
,
sourceLocal(ParserNamespace)
and treeScoped(ParserNamespace)
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addTo
(NamespaceStorage.GlobalStorage global, NamespaceStorage storage, K key, V value) Adds a key/value to corresponding namespace storage according to param class.protected final void
addToStorage
(NamespaceStorage storage, K key, V value) protected MoreObjects.ToStringHelper
addToStringAttributes
(MoreObjects.ToStringHelper toStringHelper) getAllFrom
(NamespaceStorage.GlobalStorage global, NamespaceStorage storage) Returns all values of a keys of param class from model namespace storage.getAllFromLocalStorage
(NamespaceStorage storage) abstract V
getFrom
(NamespaceStorage.GlobalStorage global, NamespaceStorage storage, K key) Returns a value from model namespace storage according to key param class.getFrom
(NamespaceStorage.GlobalStorage global, NamespaceStorage storage, NamespaceKeyCriterion<K> criterion) Returns the key/value mapping best matching specified criterion.protected final V
getFromLocalStorage
(NamespaceStorage storage, K key) static <K,
V> @NonNull NamespaceBehaviour<K, V> global
(ParserNamespace<K, V> namespace) Creates a global namespace behaviour for supplied namespace type.final @NonNull ParserNamespace<K,
V> static <K,
V> @NonNull NamespaceBehaviour<K, V> rootStatementLocal
(ParserNamespace<K, V> namespace) Creates a root-statement-local namespace behaviour for supplied namespace type.static <K,
V> @NonNull NamespaceBehaviour<K, V> sourceLocal
(ParserNamespace<K, V> namespace) Creates source-local namespace behaviour for supplied namespace type.static <K,
V> @NonNull NamespaceBehaviour<K, V> statementLocal
(ParserNamespace<K, V> namespace) final String
toString()
static <K,
V> @NonNull NamespaceBehaviour<K, V> treeScoped
(ParserNamespace<K, V> namespace) Creates tree-scoped namespace behaviour for supplied namespace type.
-
Constructor Details
-
NamespaceBehaviour
-
-
Method Details
-
namespace
-
global
Creates a global namespace behaviour for supplied namespace type. Global behaviour stores and loads all values from rootNamespaceStorage
with type ofNamespaceStorage.StorageType.GLOBAL
.- Type Parameters:
K
- Namespace key typeV
- Namespace value type- Parameters:
namespace
- Namespace identifier- Returns:
- global namespace behaviour for supplied namespace type.
-
sourceLocal
Creates source-local namespace behaviour for supplied namespace type. Source-local namespace behaviour stores and loads all values from closestNamespaceStorage
ancestor with type ofNamespaceStorage.StorageType.SOURCE_LOCAL_SPECIAL
.- Type Parameters:
K
- Namespace key typeV
- Namespace value type- Parameters:
namespace
- Namespace identifier- Returns:
- source-local namespace behaviour for supplied namespace type.
-
statementLocal
public static <K,V> @NonNull NamespaceBehaviour<K,V> statementLocal(ParserNamespace<K, V> namespace) -
rootStatementLocal
public static <K,V> @NonNull NamespaceBehaviour<K,V> rootStatementLocal(ParserNamespace<K, V> namespace) Creates a root-statement-local namespace behaviour for supplied namespace type. Root-statement-local namespace behaviour stores and loads all values from closestNamespaceStorage
ancestor with type ofNamespaceStorage.StorageType.ROOT_STATEMENT_LOCAL
.- Type Parameters:
K
- Namespace key typeV
- Namespace value type- Parameters:
namespace
- Namespace identifier- Returns:
- root-statement-local namespace behaviour for supplied namespace type.
-
treeScoped
Creates tree-scoped namespace behaviour for supplied namespace type. Tree-scoped namespace behaviour searches for value in all storage nodes up to the root and stores values in supplied node.- Type Parameters:
K
- Namespace key typeV
- Namespace value type- Parameters:
namespace
- Namespace identifier- Returns:
- tree-scoped namespace behaviour for supplied namespace type.
-
getFrom
Returns a value from model namespace storage according to key param class.- Parameters:
global
- global namespace storagestorage
- namespace storagekey
- type parameter- Returns:
- value from model namespace storage according to key param class
-
getFrom
public final @Nullable Map.Entry<K,V> getFrom(NamespaceStorage.GlobalStorage global, NamespaceStorage storage, NamespaceKeyCriterion<K> criterion) Returns the key/value mapping best matching specified criterion.- Parameters:
global
- global namespace storagestorage
- namespace storagecriterion
- selection criterion- Returns:
- Selected mapping, if available.
-
getAllFrom
public abstract Map<K,V> getAllFrom(NamespaceStorage.GlobalStorage global, NamespaceStorage storage) Returns all values of a keys of param class from model namespace storage.- Parameters:
global
- global namespace storagestorage
- namespace storage- Returns:
- all values of keys of param class from model namespace storage
-
addTo
public abstract void addTo(NamespaceStorage.GlobalStorage global, NamespaceStorage storage, K key, V value) Adds a key/value to corresponding namespace storage according to param class.- Parameters:
global
- global namespace storagestorage
- namespace storagekey
- type parametervalue
- type parameter
-
getFromLocalStorage
-
getAllFromLocalStorage
-
addToStorage
-
toString
-
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
-