Introduce "Aware" superinterface

All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:

    * Easy access to a type hierarchy that can answer the question
      "What *Aware interfaces are available?", without requiring
      text-based searches. Also clearly excludes false positives like
      TargetClassAware and ParamAware, which while similarly named,
      are not semantically similar to traditional *Aware interfaces
      in Spring.

    * Minor potential performance improvements in
      AbstractAutowireCapableBeanFactory and
      ApplicationContextAwareProcessor. Both have blocks of sequential
      instanceof checks in order to invoke any *Aware interface callback
      methods. For a bean that implements none of these interfaces,
      the whole sequence can be avoided by guarding first with
          if (bean instanceof Aware) {
              ...
          }

Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3840 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Chris Beams
2011-01-03 10:13:57 +00:00
parent 1ac7b56caf
commit d00b49dca5
21 changed files with 144 additions and 62 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.scheduling.quartz;
import org.quartz.SchedulerContext;
import org.springframework.beans.factory.Aware;
/**
* Callback interface to be implemented by Spring-managed
@@ -27,11 +28,12 @@ import org.quartz.SchedulerContext;
* that are passed in via Spring's SchedulerFactoryBean.
*
* @author Juergen Hoeller
* @author Chris Beams
* @since 2.0
* @see org.quartz.spi.JobFactory
* @see SchedulerFactoryBean#setJobFactory
*/
public interface SchedulerContextAware {
public interface SchedulerContextAware extends Aware {
/**
* Set the SchedulerContext of the current Quartz Scheduler.