org.acegisecurity.util
Class OrderedUtils

java.lang.Object
  extended by org.acegisecurity.util.OrderedUtils

public abstract class OrderedUtils
extends Object

Proivdes common logic for manipulating classes implementing the Spring Ordered interface.

Author:
Ben Alex

Constructor Summary
OrderedUtils()
           
 
Method Summary
static boolean copyOrderFromOtherClass(Class sourceClass, ApplicationContext applicationContext, Object destinationObject, boolean skipIfMoreThanOneCandidateSourceClassInstance)
          Introspects the application context for a single instance of sourceClass.
static void copyOrderFromOtherObject(Ordered sourceObject, Object destinationObject)
          Copies the order property from the sourceObject into the destinationObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedUtils

public OrderedUtils()
Method Detail

copyOrderFromOtherClass

public static boolean copyOrderFromOtherClass(Class sourceClass,
                                              ApplicationContext applicationContext,
                                              Object destinationObject,
                                              boolean skipIfMoreThanOneCandidateSourceClassInstance)
Introspects the application context for a single instance of sourceClass. If found, the order from the source class instance is copied into the destinationObject. If more than one instance of sourceClass is found, the method throws IllegalStateException.

The destinationObject is required to provide a public setOrder(int) method to permit mutation of the order property.

Parameters:
sourceClass - to locate in the application context (must be assignable to Ordered)
applicationContext - to locate the class
destinationObject - to copy the order into (must provide public setOrder(int) method)
skipIfMoreThanOneCandidateSourceClassInstance - if the application context provides more than one potential source, skip modifications (if false, the first located matching source will be used)
Returns:
whether or not the destination class was updated

copyOrderFromOtherObject

public static void copyOrderFromOtherObject(Ordered sourceObject,
                                            Object destinationObject)
Copies the order property from the sourceObject into the destinationObject.

The destinationObject is required to provide a public setOrder(int) method to permit mutation of the order property.

Parameters:
sourceObject - to copy the order from
destinationObject - to copy the order into (must provide public setOrder(int) method)


Copyright © 2004-2007 Interface21, Inc. All Rights Reserved.