import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
+import com.google.common.base.Verify;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
private JSONCodecFactory(final SchemaContext context) {
this.schemaContext = Preconditions.checkNotNull(context);
- iidCodec = new JSONStringInstanceIdentifierCodec(context);
+ iidCodec = new JSONStringInstanceIdentifierCodec(context, this);
}
/**
// FIXME: Verify if this does indeed support leafref of leafref
final TypeDefinition<?> referencedType =
SchemaContextUtil.getBaseTypeForLeafRef(type, getSchemaContext(), schema);
+ Verify.verifyNotNull(referencedType, "Unable to find base type for leafref node '%s'.", schema.getPath());
return createCodec(schema, referencedType);
}
return (JSONCodec<Object>) iidCodec;
}
if (type instanceof EmptyTypeDefinition) {
- return (JSONCodec<Object>) JSONEmptyCodec.INSTANCE;
+ return JSONEmptyCodec.INSTANCE;
}
final TypeDefinitionAwareCodec<Object, ?> codec = TypeDefinitionAwareCodec.from(type);