private ObjectCodec(final TypeDefinition<?> typeDefinition, final DOMMountPoint mountPoint,
final ControllerContext controllerContext) {
this.controllerContext = controllerContext;
- this.type = RestUtil.resolveBaseTypeFrom(typeDefinition);
- if (this.type instanceof IdentityrefTypeDefinition) {
- this.identityrefCodec = new IdentityrefCodecImpl(mountPoint, controllerContext);
+ type = RestUtil.resolveBaseTypeFrom(typeDefinition);
+ if (type instanceof IdentityrefTypeDefinition) {
+ identityrefCodec = new IdentityrefCodecImpl(mountPoint, controllerContext);
} else {
- this.identityrefCodec = null;
+ identityrefCodec = null;
}
- if (this.type instanceof InstanceIdentifierTypeDefinition) {
- this.instanceIdentifier = new InstanceIdentifierCodecImpl(mountPoint, controllerContext);
+ if (type instanceof InstanceIdentifierTypeDefinition) {
+ instanceIdentifier = new InstanceIdentifierCodecImpl(mountPoint, controllerContext);
} else {
- this.instanceIdentifier = null;
+ instanceIdentifier = null;
}
}
@Override
public Object deserialize(final Object input) {
try {
- if (this.type instanceof IdentityrefTypeDefinition) {
+ if (type instanceof IdentityrefTypeDefinition) {
if (input instanceof IdentityValuesDTO) {
- return this.identityrefCodec.deserialize(input);
+ return identityrefCodec.deserialize(input);
}
if (LOG.isDebugEnabled()) {
LOG.debug(
input == null ? "null" : input.getClass(), String.valueOf(input));
}
return null;
- } else if (this.type instanceof InstanceIdentifierTypeDefinition) {
+ } else if (type instanceof InstanceIdentifierTypeDefinition) {
if (input instanceof IdentityValuesDTO) {
- return this.instanceIdentifier.deserialize(input);
+ return instanceIdentifier.deserialize(input);
} else {
final StringModuleInstanceIdentifierCodec codec = new StringModuleInstanceIdentifierCodec(
controllerContext.getGlobalSchema());
}
} else {
final TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> typeAwarecodec =
- TypeDefinitionAwareCodec.from(this.type);
+ TypeDefinitionAwareCodec.from(type);
if (typeAwarecodec != null) {
if (input instanceof IdentityValuesDTO) {
return typeAwarecodec.deserialize(((IdentityValuesDTO) input).getOriginValue());
@Override
public Object serialize(final Object input) {
try {
- if (this.type instanceof IdentityrefTypeDefinition) {
- return this.identityrefCodec.serialize(input);
- } else if (this.type instanceof LeafrefTypeDefinition) {
+ if (type instanceof IdentityrefTypeDefinition) {
+ return identityrefCodec.serialize(input);
+ } else if (type instanceof LeafrefTypeDefinition) {
return LEAFREF_DEFAULT_CODEC.serialize(input);
- } else if (this.type instanceof InstanceIdentifierTypeDefinition) {
- return this.instanceIdentifier.serialize(input);
+ } else if (type instanceof InstanceIdentifierTypeDefinition) {
+ return instanceIdentifier.serialize(input);
} else {
final TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> typeAwarecodec =
- TypeDefinitionAwareCodec.from(this.type);
+ TypeDefinitionAwareCodec.from(type);
if (typeAwarecodec != null) {
return typeAwarecodec.serialize(input);
} else {
@Override
public QName deserialize(final IdentityValuesDTO data) {
final IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
- final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), this.mountPoint,
+ final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint,
controllerContext);
if (module == null) {
LOG.info("Module was not found for namespace {}", valueWithNamespace.getNamespace());
public YangInstanceIdentifier deserialize(final IdentityValuesDTO data) {
final List<PathArgument> result = new ArrayList<>();
final IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
- final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), this.mountPoint,
+ final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint,
controllerContext);
if (module == null) {
LOG.info("Module by namespace '{}' of first node in instance-identifier was not found.",
final List<IdentityValue> identities = data.getValuesWithNamespaces();
for (int i = 0; i < identities.size(); i++) {
final IdentityValue identityValue = identities.get(i);
- XMLNamespace validNamespace = resolveValidNamespace(identityValue.getNamespace(), this.mountPoint,
+ XMLNamespace validNamespace = resolveValidNamespace(identityValue.getNamespace(), mountPoint,
controllerContext);
final DataSchemaNode node = ControllerContext.findInstanceDataChildByNameAndNamespace(
parentContainer, identityValue.getValue(), validNamespace);
final DataNodeContainer listNode = (DataNodeContainer) node;
final Map<QName, Object> predicatesMap = new HashMap<>();
for (final Predicate predicate : identityValue.getPredicates()) {
- validNamespace = resolveValidNamespace(predicate.getName().getNamespace(), this.mountPoint,
+ validNamespace = resolveValidNamespace(predicate.getName().getNamespace(), mountPoint,
controllerContext);
final DataSchemaNode listKey = ControllerContext
.findInstanceDataChildByNameAndNamespace(listNode, predicate.getName().getValue(),
Module module = null;
if (mountPoint != null) {
- module = controllerContext.findModuleByNamespace(mountPoint, validNamespace);
+ module = ControllerContext.findModuleByNamespace(mountPoint, validNamespace);
} else {
module = controllerContext.findModuleByNamespace(validNamespace);
}
final ControllerContext controllerContext) {
XMLNamespace validNamespace;
if (mountPoint != null) {
- validNamespace = controllerContext.findNamespaceByModuleName(mountPoint, namespace);
+ validNamespace = ControllerContext.findNamespaceByModuleName(mountPoint, namespace);
} else {
validNamespace = controllerContext.findNamespaceByModuleName(namespace);
}