001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.context.annotation;
018
019import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
020import org.springframework.beans.factory.support.BeanDefinitionRegistry;
021import org.springframework.core.env.Environment;
022import org.springframework.core.io.ResourceLoader;
023
024/**
025 * Context information for use by {@link Condition}s.
026 *
027 * @author Phillip Webb
028 * @author Juergen Hoeller
029 * @since 4.0
030 */
031public interface ConditionContext {
032
033        /**
034         * Return the {@link BeanDefinitionRegistry} that will hold the bean definition
035         * should the condition match, or {@code null} if the registry is not available.
036         */
037        BeanDefinitionRegistry getRegistry();
038
039        /**
040         * Return the {@link ConfigurableListableBeanFactory} that will hold the bean
041         * definition should the condition match, or {@code null} if the bean factory
042         * is not available.
043         */
044        ConfigurableListableBeanFactory getBeanFactory();
045
046        /**
047         * Return the {@link Environment} for which the current application is running,
048         * or {@code null} if no environment is available.
049         */
050        Environment getEnvironment();
051
052        /**
053         * Return the {@link ResourceLoader} currently being used, or {@code null} if
054         * the resource loader cannot be obtained.
055         */
056        ResourceLoader getResourceLoader();
057
058        /**
059         * Return the {@link ClassLoader} that should be used to load additional classes,
060         * or {@code null} if the default classloader should be used.
061         */
062        ClassLoader getClassLoader();
063
064}