public static DataModel<Object> getItems(FacesContext facesContext, UIComponent component, String value) {
if (!(component instanceof AutocompleteProps)) {
return null;
}
AutocompleteProps autocomplete = (AutocompleteProps) component;
Object itemsObject = null;
MethodExpression autocompleteMethod = autocomplete.getAutocompleteMethod();
if (autocompleteMethod != null) {
try {
try {
itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { facesContext,
component, value });
} catch (MethodNotFoundException e1) {
try {
// fall back to evaluating an expression assuming there is just one parameter (RF-11469)
itemsObject = autocomplete.getAutocompleteMethodWithOneParameter().invoke(facesContext.getELContext(), new Object[] { value });
} catch (MethodNotFoundException e2) {
ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
autocompleteMethod = expressionFactory.createMethodExpression(facesContext.getELContext(),
autocompleteMethod.getExpressionString(), Object.class, new Class[] { String.class });
itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { value });
}
}
} catch (ELException ee) {
LOGGER.error(ee.getMessage(), ee);
}
} else {
itemsObject = autocomplete.getAutocompleteList();
}
DataModel result;
if (itemsObject instanceof Object[]) {