org.mule.config
Class PreferredObjectSelector<T>

java.lang.Object
  extended by org.mule.config.PreferredObjectSelector<T>

public class PreferredObjectSelector<T>
extends Object

Selects a preferred object from a collection of instances of the same type based on the weight of the Preferred annotation. If there is no preferred instances, then it just returns the first object in the collection.


Constructor Summary
PreferredObjectSelector()
           
 
Method Summary
 T select(Iterator<T> iterator)
          Selects a preferred object from instances returned by an Iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferredObjectSelector

public PreferredObjectSelector()
Method Detail

select

public T select(Iterator<T> iterator)
Selects a preferred object from instances returned by an Iterator.

The preferred instance will be the instance annotated with Preferred annotation with the highest weight attribute if there is any, or a non annotated class otherwise.

Parameters:
iterator - contains the objects to select from
Returns:
the preferred instance


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.