* @since 1.2.10, 2.0.2
*/
@SuppressWarnings("unchecked")
protected void sortELResolvers(List<ELResolver> resolvers)
{
ExternalContext externalContext
= FacesContext.getCurrentInstance().getExternalContext();
String comparatorClass = externalContext
.getInitParameter(EL_RESOLVER_COMPARATOR);
if (comparatorClass != null && !"".equals(comparatorClass))
{
// the user provided the parameter.
// if we already have a cached instance, use it
Comparator<ELResolver> comparator
= (Comparator<ELResolver>) externalContext.
getApplicationMap().get(EL_RESOLVER_COMPARATOR);
try
{
if (comparator == null)
{
// get the comparator class
Class<Comparator<ELResolver>> clazz
= ClassUtils.classForName(comparatorClass);
// create the instance
comparator = clazz.newInstance();
// cache the instance, because it will be used at least two times
externalContext.getApplicationMap()
.put(EL_RESOLVER_COMPARATOR, comparator);
}
// sort the resolvers
Collections.sort(resolvers, comparator);