public ConverterChain(UIComponent component)
{
this();
if (component instanceof ValueHolder)
{
ValueHolder valueHolder = (ValueHolder) component;
if (!(valueHolder.getConverter() instanceof ConverterChain))
{
ValueExpression converterValueExpression = component.getValueExpression("converter");
if (converterValueExpression != null)
{
addConverterToChain(converterValueExpression);
}
else if (valueHolder.getConverter() != null)
{
addConverterToChain(valueHolder.getConverter());
}
else
{
ValueExpression valueExpression = component.getValueExpression("value");
FacesContext facesContext = FacesContext.getCurrentInstance();
if (valueExpression != null)
{
Class<?> type = valueExpression.getType(facesContext.getELContext());
if (type != null)
{
Converter converter = facesContext.getApplication().createConverter(type);
if (converter != null)
{
addConverterToChain(converter);
}
}
}
}
valueHolder.setConverter(this);
}
}
}