- @SuppressWarnings("checkstyle:illegalCatch")
- private static BindingNormalizedNodeCodecRegistry codec(final Class<?>... classes) {
- final ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
- for (final Class<?> clazz : classes) {
- YangModuleInfo modInfo;
- try {
- modInfo = BindingReflections.getModuleInfo(clazz);
- ctx.registerModuleInfo(modInfo);
- } catch (final Exception e) {
- throw new IllegalStateException(e);
- }
- }
- final SchemaContext schema = ctx.tryToCreateSchemaContext().get();
- final BindingRuntimeContext runtimeCtx = BindingRuntimeContext.create(ctx, schema);
- final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(runtimeCtx);
- return registry;
+ private static BindingNormalizedNodeSerializer codec(final Class<?>... classes) {
+ return new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext(classes));