Class AbstractModuleStringInstanceIdentifierCodec
- java.lang.Object
-
- org.opendaylight.yangtools.concepts.AbstractIllegalArgumentCodec<String,T>
-
- org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec
-
- org.opendaylight.yangtools.yang.data.util.AbstractModuleStringInstanceIdentifierCodec
-
- All Implemented Interfaces:
IllegalArgumentCodec<String,YangInstanceIdentifier>
,InstanceIdentifierCodec<String>
@Beta public abstract class AbstractModuleStringInstanceIdentifierCodec extends AbstractStringInstanceIdentifierCodec
Extension ofAbstractStringInstanceIdentifierCodec
, which instantiates QNames by first resolving the namespace and then looking the target namespace in the list of currently-subscribed modules.
-
-
Constructor Summary
Constructors Constructor Description AbstractModuleStringInstanceIdentifierCodec()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected @NonNull StringBuilder
appendQName(StringBuilder sb, QName qname)
protected StringBuilder
appendQName(StringBuilder sb, QName qname, @Nullable QNameModule lastModule)
Append a QName, potentially taking into account last QNameModule encountered in the serialized path.protected QName
createQName(String prefix, String localName)
Create a QName for a prefix and local name.protected abstract @Nullable Module
moduleForPrefix(@NonNull String prefix)
Resolve a string prefix into the corresponding module.protected QName
parseQName(String str)
protected abstract @Nullable String
prefixForNamespace(@NonNull XMLNamespace namespace)
Return string prefix for a particular namespace, allocating a new one if necessary.-
Methods inherited from class org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec
createQName, deserializeImpl, deserializeKeyValue, getDataContextTree, serializeImpl
-
Methods inherited from class org.opendaylight.yangtools.concepts.AbstractIllegalArgumentCodec
deserialize, serialize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.concepts.IllegalArgumentCodec
deserialize, serialize
-
-
-
-
Method Detail
-
moduleForPrefix
protected abstract @Nullable Module moduleForPrefix(@NonNull String prefix)
Resolve a string prefix into the corresponding module.- Parameters:
prefix
- Prefix- Returns:
- module mapped to prefix, or null if the module cannot be resolved
-
createQName
protected final QName createQName(String prefix, String localName)
Create a QName for a prefix and local name.- Parameters:
prefix
- Prefix for namespacelocalName
- local name- Returns:
- QName
-
prefixForNamespace
protected abstract @Nullable String prefixForNamespace(@NonNull XMLNamespace namespace)
Return string prefix for a particular namespace, allocating a new one if necessary.- Parameters:
namespace
- Namespace to map- Returns:
- Allocated unique prefix, or null if the prefix cannot be mapped.
-
appendQName
protected final @NonNull StringBuilder appendQName(StringBuilder sb, QName qname)
-
appendQName
protected StringBuilder appendQName(StringBuilder sb, QName qname, @Nullable QNameModule lastModule)
Append a QName, potentially taking into account last QNameModule encountered in the serialized path.- Parameters:
sb
- target StringBuilderqname
- QName to appendlastModule
- last QNameModule encountered, may be null- Returns:
- target StringBuilder
-
-