import org.slf4j.LoggerFactory;
public class RestCodec {
-
+
private static final Logger logger = LoggerFactory.getLogger(RestCodec.class);
private RestCodec() {
input == null ? "null" : input.getClass(), String.valueOf(input));
return null;
} else if (type instanceof LeafrefTypeDefinition) {
+ if (input instanceof IdentityValuesDTO) {
+ return LEAFREF_DEFAULT_CODEC.deserialize(((IdentityValuesDTO)input).getOriginValue());
+ }
return LEAFREF_DEFAULT_CODEC.deserialize(input);
} else if (type instanceof InstanceIdentifierTypeDefinition) {
if (input instanceof IdentityValuesDTO) {
TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> typeAwarecodec = TypeDefinitionAwareCodec
.from(type);
if (typeAwarecodec != null) {
+ if (input instanceof IdentityValuesDTO) {
+ return typeAwarecodec.deserialize(((IdentityValuesDTO)input).getOriginValue());
+ }
return typeAwarecodec.deserialize(String.valueOf(input));
} else {
logger.debug("Codec for type \"" + type.getQName().getLocalName()
@Override
public IdentityValuesDTO serialize(QName data) {
- return new IdentityValuesDTO(data.getNamespace().toString(), data.getLocalName(), data.getPrefix());
+ return new IdentityValuesDTO(data.getNamespace().toString(), data.getLocalName(), data.getPrefix(),null);
}
@Override
logger.info("Idenetityref will be translated as NULL for data - {}", String.valueOf(valueWithNamespace));
return null;
}
-
+
return QName.create(module.getNamespace(), module.getRevision(), valueWithNamespace.getValue());
}
}
}
}
-
+
return result.isEmpty() ? null : new InstanceIdentifier(result);
}
return null;
}
}
-
+
private static Module getModuleByNamespace(String namespace, MountInstance mountPoint) {
URI validNamespace = resolveValidNamespace(namespace, mountPoint);
}
return module;
}
-
+
private static URI resolveValidNamespace(String namespace, MountInstance mountPoint) {
URI validNamespace;
if (mountPoint != null) {