Class AbstractStringIdentityrefCodec
java.lang.Object
org.opendaylight.yangtools.yang.data.api.codec.AbstractIllegalArgumentCodec<String,T>
org.opendaylight.yangtools.yang.data.util.AbstractStringIdentityrefCodec
- All Implemented Interfaces:
IdentityrefCodec<String>
,IllegalArgumentCodec<String,
QName>
- Direct Known Subclasses:
AbstractModuleStringIdentityrefCodec
@Beta
public abstract class AbstractStringIdentityrefCodec
extends AbstractIllegalArgumentCodec<String,T>
implements IdentityrefCodec<String>
Abstract utility class for representations which encode Identityref as a
prefix:name tuple. Typical uses are RESTCONF/JSON (module:name) and XML (prefix:name).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final @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 abstract @Nullable QName
createQName
(@NonNull String prefix, @NonNull String localName) Create a QName for a prefix and local name.protected final QName
deserializeImpl
(String data) protected final 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.protected final String
serializeImpl
(QName data) Methods inherited from class org.opendaylight.yangtools.yang.data.api.codec.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.yang.data.api.codec.IllegalArgumentCodec
deserialize, serialize
-
Constructor Details
-
AbstractStringIdentityrefCodec
public AbstractStringIdentityrefCodec()
-
-
Method Details
-
serializeImpl
- Specified by:
serializeImpl
in classAbstractIllegalArgumentCodec<String,
QName>
-
deserializeImpl
- Specified by:
deserializeImpl
in classAbstractIllegalArgumentCodec<String,
QName>
-
prefixForNamespace
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.
-
createQName
Create a QName for a prefix and local name.- Parameters:
prefix
- Prefix for namespacelocalName
- local name- Returns:
- QName
- Throws:
IllegalArgumentException
- if the prefix cannot be resolved
-
appendQName
-
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
-
parseQName
-