001/*
002 * Copyright 2002-2012 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.event;
018
019import org.springframework.context.ApplicationContext;
020import org.springframework.context.ApplicationEvent;
021
022/**
023 * Base class for events raised for an {@code ApplicationContext}.
024 *
025 * @author Juergen Hoeller
026 * @since 2.5
027 */
028@SuppressWarnings("serial")
029public abstract class ApplicationContextEvent extends ApplicationEvent {
030
031        /**
032         * Create a new ContextStartedEvent.
033         * @param source the {@code ApplicationContext} that the event is raised for
034         * (must not be {@code null})
035         */
036        public ApplicationContextEvent(ApplicationContext source) {
037                super(source);
038        }
039
040        /**
041         * Get the {@code ApplicationContext} that the event was raised for.
042         */
043        public final ApplicationContext getApplicationContext() {
044                return (ApplicationContext) getSource();
045        }
046
047}