@Beta public abstract class AbstractStringInstanceIdentifierCodec extends Object implements InstanceIdentifierCodec<String>
YangInstanceIdentifier
as a
prefix:name tuple. Typical uses are RESTCONF/JSON (module:name) and XML (prefix:name).Constructor and Description |
---|
AbstractStringInstanceIdentifierCodec() |
Modifier and Type | Method and Description |
---|---|
protected 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(@Nullable QNameModule lastModule,
String localName)
Create QName from unprefixed name, potentially taking last QNameModule encountered into account.
|
protected abstract @Nullable QName |
createQName(@NonNull String prefix,
@NonNull String localName)
Create a QName for a prefix and local name.
|
YangInstanceIdentifier |
deserialize(String data)
Produce an object base on input.
|
protected Object |
deserializeKeyValue(DataSchemaNode schemaNode,
String value) |
protected abstract @NonNull DataSchemaContextTree |
getDataContextTree()
Returns DataSchemaContextTree associated with SchemaContext for which
serialization / deserialization occurs.
|
protected QName |
parseQName(String str) |
protected abstract @Nullable String |
prefixForNamespace(@NonNull URI namespace)
Return string prefix for a particular namespace, allocating a new one if necessary.
|
String |
serialize(YangInstanceIdentifier data) |
public AbstractStringInstanceIdentifierCodec()
public final String serialize(YangInstanceIdentifier data)
serialize
in interface Codec<String,YangInstanceIdentifier>
serialize
in interface Serializer<String,YangInstanceIdentifier>
serialize
in interface InstanceIdentifierCodec<String>
protected abstract @NonNull DataSchemaContextTree getDataContextTree()
Implementations MUST provide non-null Data Tree context, in order for correct serialization / deserialization of PathArguments, since XML representation does not have Augmentation arguments and does not provide path arguments for cases.
This effectively means same input XPath representation of Path Argument may result in different YangInstanceIdentifiers if models are different in uses of choices and cases.
protected Object deserializeKeyValue(DataSchemaNode schemaNode, String value)
public final YangInstanceIdentifier deserialize(String data)
Deserializer
deserialize
in interface Codec<String,YangInstanceIdentifier>
deserialize
in interface Deserializer<YangInstanceIdentifier,String>
deserialize
in interface InstanceIdentifierCodec<String>
data
- Input objectprotected QName createQName(@Nullable QNameModule lastModule, String localName)
lastModule
- last QNameModule encountered, potentially nulllocalName
- Local name stringprotected abstract @Nullable String prefixForNamespace(@NonNull URI namespace)
namespace
- Namespace to mapprotected abstract @Nullable QName createQName(@NonNull String prefix, @NonNull String localName)
prefix
- Prefix for namespacelocalName
- local nameIllegalArgumentException
- if the prefix cannot be resolvedprotected final StringBuilder appendQName(StringBuilder sb, QName qname)
protected StringBuilder appendQName(StringBuilder sb, QName qname, @Nullable QNameModule lastModule)
sb
- target StringBuilderqname
- QName to appendlastModule
- last QNameModule encountered, may be nullCopyright © 2019 OpenDaylight. All rights reserved.