@Override public DynamicType.Unloaded<T> make() { MethodRegistry.Compiled compiledMethodRegistry = constructorStrategy .inject(methodRegistry, defaultMethodAttributeAppenderFactory) .prepare( applyConstructorStrategy( new InstrumentedType.Default( namingStrategy.name( new NamingStrategy.UnnamedType.Default( targetType, interfaceTypes, modifiers, classFileVersion)), modifiers, Collections.<GenericTypeDescription>emptyList(), targetType, interfaceTypes, fieldTokens, methodTokens, Collections.<AnnotationDescription>emptyList(), InstrumentedType.TypeInitializer.None.INSTANCE, LoadedTypeInitializer.NoOp.INSTANCE)), methodGraphCompiler, new InstrumentableMatcher(ignoredMethods)) .compile( new SubclassImplementationTarget.Factory( SubclassImplementationTarget.OriginTypeResolver.SUPER_TYPE)); return TypeWriter.Default.<T>forCreation( compiledMethodRegistry, fieldRegistry.compile(compiledMethodRegistry.getInstrumentedType()), auxiliaryTypeNamingStrategy, implementationContextFactory, classVisitorWrapper, attributeAppender, classFileVersion) .make(); }
@Override public boolean equals(Object other) { return this == other || !(other == null || getClass() != other.getClass()) && super.equals(other) && constructorStrategy.equals( ((SubclassDynamicTypeBuilder<?>) other).constructorStrategy); }
/** * Applies this builder's constructor strategy to the given instrumented type. * * @param instrumentedType The instrumented type to apply the constructor onto. * @return The instrumented type with the constructor strategy applied onto. */ private InstrumentedType applyConstructorStrategy(InstrumentedType instrumentedType) { if (instrumentedType.isInterface()) { return instrumentedType; } for (MethodDescription.Token methodToken : constructorStrategy.extractConstructors(instrumentedType)) { instrumentedType = instrumentedType.withMethod(methodToken); } return instrumentedType; }
@Override public int hashCode() { return 31 * super.hashCode() + constructorStrategy.hashCode(); }