io.micronaut.inject.DelegatingBeanDefinition Maven / Gradle / Ivy
/*
* Copyright 2017-2020 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.inject;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.context.BeanContext;
import io.micronaut.context.BeanResolutionContext;
import io.micronaut.core.annotation.AnnotationMetadata;
import io.micronaut.core.type.Argument;
import io.micronaut.core.annotation.NonNull;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
/**
* An interface for wrapping a {@link BeanDefinition} with another that delegates and potentially decorates the
* {@link BeanDefinition} instance.
*
* @param The bean definition type
* @author Graeme Rocher
* @since 1.0
*/
public interface DelegatingBeanDefinition extends BeanDefinition {
/**
* @return The target definition
*/
BeanDefinition getTarget();
@Override
default boolean requiresMethodProcessing() {
return getTarget().requiresMethodProcessing();
}
@Override
default Optional> getScope() {
return getTarget().getScope();
}
@Override
default AnnotationMetadata getAnnotationMetadata() {
return getTarget().getAnnotationMetadata();
}
@Override
default ExecutableMethod getRequiredMethod(String name, Class... argumentTypes) {
return getTarget().getRequiredMethod(name, argumentTypes);
}
@Override
default boolean isAbstract() {
return getTarget().isAbstract();
}
@Override
default boolean isSingleton() {
return getTarget().isSingleton();
}
@Override
default boolean isProvided() {
return getTarget().isProvided();
}
@Override
default boolean isIterable() {
return getTarget().isIterable();
}
@Override
default Class getBeanType() {
return getTarget().getBeanType();
}
@Override
default ConstructorInjectionPoint getConstructor() {
return getTarget().getConstructor();
}
@Override
default Collection getRequiredComponents() {
return getTarget().getRequiredComponents();
}
@Override
default Collection getInjectedMethods() {
return getTarget().getInjectedMethods();
}
@Override
default Collection getInjectedFields() {
return getTarget().getInjectedFields();
}
@Override
default Collection getPostConstructMethods() {
return getTarget().getPostConstructMethods();
}
@Override
default Collection getPreDestroyMethods() {
return getTarget().getPreDestroyMethods();
}
@Override
default String getName() {
return getTarget().getName();
}
@Override
default Optional> findMethod(String name, Class... argumentTypes) {
return getTarget().findMethod(name, argumentTypes);
}
@Override
default Stream> findPossibleMethods(String name) {
return getTarget().findPossibleMethods(name);
}
@Override
default T inject(BeanContext context, T bean) {
return getTarget().inject(context, bean);
}
@Override
default T inject(BeanResolutionContext resolutionContext, BeanContext context, T bean) {
return getTarget().inject(resolutionContext, context, bean);
}
@Override
default Collection> getExecutableMethods() {
return getTarget().getExecutableMethods();
}
@Override
default boolean isPrimary() {
return getTarget().isPrimary();
}
@Override
default boolean isEnabled(BeanContext context) {
return getTarget().isEnabled(context);
}
@Override
default boolean isEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext) {
return getTarget().isEnabled(context, resolutionContext);
}
@Override
default Optional> getDeclaringType() {
return getTarget().getDeclaringType();
}
@Override
default @NonNull List> getTypeArguments(String type) {
return getTarget().getTypeArguments(type);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy