use of io.micronaut.inject.annotation.MutableAnnotationMetadata in project micronaut-core by micronaut-projects.
the class BeanDefinitionWriter method pushInvokeGetBeanForSetter.
private void pushInvokeGetBeanForSetter(GeneratorAdapter injectMethodVisitor, String setterName, ParameterElement entry) {
// load 'this'
injectMethodVisitor.loadThis();
// 1st argument load BeanResolutionContext
injectMethodVisitor.loadArg(0);
// 2nd argument load BeanContext
injectMethodVisitor.loadArg(1);
// 3rd argument the method name
injectMethodVisitor.push(setterName);
AnnotationMetadata annotationMetadata;
if (entry.getAnnotationMetadata() instanceof MutableAnnotationMetadata) {
annotationMetadata = ((MutableAnnotationMetadata) entry.getAnnotationMetadata()).clone();
removeAnnotations(annotationMetadata, PropertySource.class.getName(), Property.class.getName());
} else {
annotationMetadata = entry.getAnnotationMetadata();
}
// 4th argument the argument
if (keepConfPropInjectPoints) {
resolveMethodArgument(injectMethodVisitor, currentMethodIndex, 0);
} else {
pushCreateArgument(beanFullClassName, beanDefinitionType, classWriter, injectMethodVisitor, entry.getName(), entry.getGenericType(), annotationMetadata, entry.getGenericType().getTypeArguments(), new HashMap<>(), loadTypeMethods);
}
// push qualifier
pushQualifier(injectMethodVisitor, entry.getGenericType(), injectMethodVisitor::dup);
pushInvokeMethodOnSuperClass(injectMethodVisitor, GET_BEAN_FOR_SETTER);
// cast the return value to the correct type
pushCastToType(injectMethodVisitor, entry);
}
use of io.micronaut.inject.annotation.MutableAnnotationMetadata in project micronaut-core by micronaut-projects.
the class BeanDefinitionWriter method pushInvokeGetBeansOfTypeForSetter.
private void pushInvokeGetBeansOfTypeForSetter(GeneratorAdapter injectMethodVisitor, String setterName, ParameterElement entry) {
// load 'this'
injectMethodVisitor.loadThis();
// 1st argument load BeanResolutionContext
injectMethodVisitor.loadArg(0);
// 2nd argument load BeanContext
injectMethodVisitor.loadArg(1);
// 3rd argument the method name
injectMethodVisitor.push(setterName);
AnnotationMetadata annotationMetadata;
if (entry.getAnnotationMetadata() instanceof MutableAnnotationMetadata) {
annotationMetadata = ((MutableAnnotationMetadata) entry.getAnnotationMetadata()).clone();
removeAnnotations(annotationMetadata, PropertySource.class.getName(), Property.class.getName());
} else {
annotationMetadata = entry.getAnnotationMetadata();
}
// 4th argument the argument
ClassElement genericType = entry.getGenericType();
if (keepConfPropInjectPoints) {
resolveMethodArgument(injectMethodVisitor, currentMethodIndex, 0);
} else {
pushCreateArgument(beanFullClassName, beanDefinitionType, classWriter, injectMethodVisitor, entry.getName(), genericType, annotationMetadata, genericType.getTypeArguments(), new HashMap<>(), loadTypeMethods);
}
int thisArgument = injectMethodVisitor.newLocal(Type.getType(Argument.class));
injectMethodVisitor.storeLocal(thisArgument);
injectMethodVisitor.loadLocal(thisArgument);
if (!resolveArgumentGenericType(injectMethodVisitor, genericType)) {
injectMethodVisitor.loadLocal(thisArgument);
resolveFirstTypeArgument(injectMethodVisitor);
resolveInnerTypeArgumentIfNeeded(injectMethodVisitor, genericType);
} else {
injectMethodVisitor.push((String) null);
}
// push qualifier
pushQualifier(injectMethodVisitor, genericType, () -> injectMethodVisitor.loadLocal(thisArgument));
pushInvokeMethodOnSuperClass(injectMethodVisitor, GET_BEANS_OF_TYPE_FOR_SETTER);
// cast the return value to the correct type
pushCastToType(injectMethodVisitor, entry);
}
Aggregations