- private JSONCodec<Object> createCodec(DataSchemaNode key, TypeDefinition<?> type) {
- TypeDefinition<?> baseType = resolveBaseTypeFrom(type);
- if (baseType instanceof LeafrefTypeDefinition) {
- return createReferencedTypeCodec(key, (LeafrefTypeDefinition) baseType);
- } else if (baseType instanceof IdentityrefType) {
- final JSONCodec<?> jsonStringIdentityrefCodec = new JSONStringIdentityrefCodec(schemaContext,
- key.getQName().getModule());
+ private JSONCodec<Object> createCodec(final DataSchemaNode key, final TypeDefinition<?> type) {
+ final TypeDefinition<?> normalizedType = DerivedType.from(type);
+ if (normalizedType instanceof LeafrefTypeDefinition) {
+ return createReferencedTypeCodec(key, (LeafrefTypeDefinition) normalizedType);
+ } else if (normalizedType instanceof IdentityrefTypeDefinition) {
+ final JSONCodec<?> jsonStringIdentityrefCodec =
+ new JSONStringIdentityrefCodec(schemaContext, key.getQName().getModule());