+ final var bindingClass = getBindingClass();
+
+ // Final bits: generate the appropriate class, As a side effect we identify what Augmentations are possible
+ final List<AugmentRuntimeType> possibleAugmentations;
+ final var loader = prototype().contextFactory().getLoader();
+ if (Augmentable.class.isAssignableFrom(bindingClass)) {
+ // Verify we have the appropriate backing runtimeType
+ final var runtimeType = prototype.runtimeType();
+ if (!(runtimeType instanceof AugmentableRuntimeType augmentableRuntimeType)) {
+ throw new VerifyException(
+ "Unexpected type %s backing augmenable %s".formatted(runtimeType, bindingClass));
+ }
+
+ possibleAugmentations = augmentableRuntimeType.augments();
+ generatedClass = CodecDataObjectGenerator.generateAugmentable(loader, bindingClass, analysis.leafContexts,
+ analysis.daoProperties, keyMethod);
+ } else {
+ possibleAugmentations = List.of();
+ generatedClass = CodecDataObjectGenerator.generate(loader, bindingClass, analysis.leafContexts,
+ analysis.daoProperties, keyMethod);
+ }
+
+ // All done: acquire the constructor: it is supposed to be public
+ final MethodHandle ctor;
+ try {
+ ctor = MethodHandles.publicLookup().findConstructor(generatedClass, CONSTRUCTOR_TYPE);
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ throw new LinkageError("Failed to find contructor for class " + generatedClass, e);
+ }
+
+ proxyConstructor = ctor.asType(DATAOBJECT_TYPE);