import net.bytebuddy.implementation.bytecode.member.MethodVariableAccess;
import net.bytebuddy.jar.asm.Opcodes;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.mdsal.binding.dom.codec.impl.ClassGeneratorBridge.CodecContextSupplierProvider;
import org.opendaylight.mdsal.binding.dom.codec.impl.ClassGeneratorBridge.LocalNameProvider;
-import org.opendaylight.mdsal.binding.dom.codec.impl.ClassGeneratorBridge.NodeContextSupplierProvider;
import org.opendaylight.mdsal.binding.loader.BindingClassLoader;
import org.opendaylight.mdsal.binding.loader.BindingClassLoader.ClassGenerator;
import org.opendaylight.mdsal.binding.loader.BindingClassLoader.GeneratorResult;
* strong connection between a generated class to the extent possible. In most cases (grouping-generated types) this
* involves one level of indirection, which is a safe approach. If we are dealing with a type generated outside of a
* grouping statement, though, we are guaranteed instantiation-invariance and hence can hard-wire to a runtime-constant
- * {@link NodeContextSupplier} -- which provides significant boost to JITs ability to optimize code -- especially with
+ * {@link CodecContextSupplier} -- which provides significant boost to JITs ability to optimize code -- especially with
* inlining and constant propagation.
*
* <p>
* and class loading (in {@link BindingClassLoader}). The process is performed in four steps:
* <ul>
* <li>During code generation, the context fields are pointed towards
- * {@link ClassGeneratorBridge#resolveNodeContextSupplier(String)} and
+ * {@link ClassGeneratorBridge#resolveCodecContextSupplier(String)} and
* {@link ClassGeneratorBridge#resolveKey(String)} methods, which are public and static, hence perfectly usable
* in the context of a class initializer.</li>
* <li>During class loading of generated byte code, the original instance of the generator is called to wrap the actual
* class loading operation. At this point the generator installs itself as the current generator for this thread via
* {@link ClassGeneratorBridge#setup(CodecDataObjectGenerator)} and allows the class to be loaded.
* <li>After the class has been loaded, but before the call returns, we will force the class to initialize, at which
- * point the static invocations will be redirected to {@link #resolveNodeContextSupplier(String)} and
+ * point the static invocations will be redirected to {@link #resolveCodecContextSupplier(String)} and
* {@link #resolveKey(String)} methods, thus initializing the fields to the intended constants.</li>
* <li>Before returning from the class loading call, the generator will detach itself via
* {@link ClassGeneratorBridge#tearDown(CodecDataObjectGenerator)}.</li>
// FIXME: MDSAL-443: wire this implementation, which requires that BindingRuntimeTypes provides information about
// types being generated from within a grouping
private static final class Fixed<T extends CodecDataObject<?>> extends CodecDataObjectGenerator<T>
- implements NodeContextSupplierProvider<T> {
- private final ImmutableMap<Method, NodeContextSupplier> properties;
+ implements CodecContextSupplierProvider<T> {
+ private final ImmutableMap<Method, CodecContextSupplier> properties;
- Fixed(final TypeDescription superClass, final ImmutableMap<Method, NodeContextSupplier> properties,
+ Fixed(final TypeDescription superClass, final ImmutableMap<Method, CodecContextSupplier> properties,
final @Nullable Method keyMethod) {
super(superClass, keyMethod);
this.properties = requireNonNull(properties);
}
@Override
- public NodeContextSupplier resolveNodeContextSupplier(final String methodName) {
- final Optional<Entry<Method, NodeContextSupplier>> found = properties.entrySet().stream()
+ public CodecContextSupplier resolveCodecContextSupplier(final String methodName) {
+ final Optional<Entry<Method, CodecContextSupplier>> found = properties.entrySet().stream()
.filter(entry -> methodName.equals(entry.getKey().getName())).findAny();
verify(found.isPresent(), "Failed to find property for %s in %s", methodName, this);
return verifyNotNull(found.orElseThrow().getValue());
private static final class SupplierGetterMethodImplementation extends AbstractCachedMethodImplementation {
private static final StackManipulation CODEC_MEMBER = invokeMethod(CodecDataObject.class,
- "codecMember", VarHandle.class, NodeContextSupplier.class);
+ "codecMember", VarHandle.class, CodecContextSupplier.class);
private static final StackManipulation BRIDGE_RESOLVE = invokeMethod(ClassGeneratorBridge.class,
"resolveNodeContextSupplier", String.class);
- private static final Generic BB_NCS = TypeDefinition.Sort.describe(NodeContextSupplier.class);
+ private static final Generic BB_NCS = TypeDefinition.Sort.describe(CodecContextSupplier.class);
// getFoo$$$C
private final String contextName;