}
if (!(component instanceof ValueHolder)) {
// TODO Message resource i18n
throw new JspException("Component " + component.getClass().getName() + " is not instanceof ValueHolder");
}
ValueHolder valueHolder = (ValueHolder) component;
Converter converter = null;
if (isBindingSet() && !isBindingLiteral()) {
Object valueBinding = getBindingAsBindingOrExpression();
if (valueBinding != null) {
Object obj = FacesUtils.getValueFromBindingOrExpression(valueBinding);
if (obj != null && obj instanceof Converter) {
converter = (Converter) obj;
}
}
}
if (converter == null && isConverterIdSet()) {
String localConverterId;
// evaluate any VB expression that we were passed
if (!isConverterIdLiteral()) {
Object typeValueBinding = getConverterIdAsBindingOrExpression();
localConverterId = (String) FacesUtils.getValueFromBindingOrExpression(typeValueBinding);
} else {
localConverterId = getConverterIdValue();
}
converter = FacesContext.getCurrentInstance().getApplication().createConverter(localConverterId);
if (converter != null && isBindingSet()) {
Object valueBinding = getBindingAsBindingOrExpression();
FacesUtils.setValueOfBindingOrExpression(FacesContext.getCurrentInstance(), converter, valueBinding);
}
}
if (converter != null) {
if (!isBindingLiteral()) {
FacesUtils.setValueOfBindingOrExpression(
FacesContext.getCurrentInstance(), converter, component, Attributes.CONVERTER);
} else {
valueHolder.setConverter(converter);
}
}
// TODO else LOG.warn?
return (SKIP_BODY);
}