/** * Determine whether the supplied values matched the selected value. * <p>Delegates to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(@Nullable Object resolvedValue) { return SelectedValueComparator.isSelected(this.bindStatus, resolvedValue); }
if (candidateValue != null) { if (boundValue.getClass().isArray()) { selected = collectionCompare(CollectionUtils.arrayToList(boundValue), candidateValue, bindStatus); selected = collectionCompare((Collection<?>) boundValue, candidateValue, bindStatus); selected = mapCompare((Map<?, ?>) boundValue, candidateValue, bindStatus); selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
private static boolean collectionCompare( Collection<?> boundCollection, Object candidateValue, BindStatus bindStatus) { try { if (boundCollection.contains(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeSet - ignore. } return exhaustiveCollectionCompare(boundCollection, candidateValue, bindStatus); }
private static boolean exhaustiveCollectionCompare( Collection<?> collection, Object candidateValue, BindStatus bindStatus) { Map<PropertyEditor, Object> convertedValueCache = new HashMap<>(); PropertyEditor editor = null; boolean candidateIsString = (candidateValue instanceof String); if (!candidateIsString) { editor = bindStatus.findEditor(candidateValue.getClass()); } for (Object element : collection) { if (editor == null && element != null && candidateIsString) { editor = bindStatus.findEditor(element.getClass()); } if (exhaustiveCompare(element, candidateValue, editor, convertedValueCache)) { return true; } } return false; }
private static boolean exhaustiveCollectionCompare( Collection<?> collection, Object candidateValue, BindStatus bindStatus) { Map<PropertyEditor, Object> convertedValueCache = new HashMap<>(); PropertyEditor editor = null; boolean candidateIsString = (candidateValue instanceof String); if (!candidateIsString) { editor = bindStatus.findEditor(candidateValue.getClass()); } for (Object element : collection) { if (editor == null && element != null && candidateIsString) { editor = bindStatus.findEditor(element.getClass()); } if (exhaustiveCompare(element, candidateValue, editor, convertedValueCache)) { return true; } } return false; }
/** * Determines whether the supplied value matched the selected value * through delegating to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(@Nullable Object value) throws JspException { return SelectedValueComparator.isSelected(getBindStatus(), value); }
if (candidateValue != null) { if (boundValue.getClass().isArray()) { selected = collectionCompare(CollectionUtils.arrayToList(boundValue), candidateValue, bindStatus); selected = collectionCompare((Collection<?>) boundValue, candidateValue, bindStatus); selected = mapCompare((Map<?, ?>) boundValue, candidateValue, bindStatus); selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
private static boolean mapCompare(Map<?, ?> boundMap, Object candidateValue, BindStatus bindStatus) { try { if (boundMap.containsKey(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeMap - ignore. } return exhaustiveCollectionCompare(boundMap.keySet(), candidateValue, bindStatus); }
private static boolean exhaustiveCollectionCompare( Collection<?> collection, Object candidateValue, BindStatus bindStatus) { Map<PropertyEditor, Object> convertedValueCache = new HashMap<PropertyEditor, Object>(1); PropertyEditor editor = null; boolean candidateIsString = (candidateValue instanceof String); if (!candidateIsString) { editor = bindStatus.findEditor(candidateValue.getClass()); } for (Object element : collection) { if (editor == null && element != null && candidateIsString) { editor = bindStatus.findEditor(element.getClass()); } if (exhaustiveCompare(element, candidateValue, editor, convertedValueCache)) { return true; } } return false; }
/** * Determine whether the supplied values matched the selected value. * <p>Delegates to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(@Nullable Object resolvedValue) { return SelectedValueComparator.isSelected(this.bindStatus, resolvedValue); }
selected = collectionCompare(CollectionUtils.arrayToList(boundValue), candidateValue, bindStatus); selected = collectionCompare((Collection<?>) boundValue, candidateValue, bindStatus); selected = mapCompare((Map<?, ?>) boundValue, candidateValue, bindStatus); selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
private static boolean collectionCompare( Collection<?> boundCollection, Object candidateValue, BindStatus bindStatus) { try { if (boundCollection.contains(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeSet - ignore. } return exhaustiveCollectionCompare(boundCollection, candidateValue, bindStatus); }
private boolean isSelected(Object resolvedValue) { return SelectedValueComparator.isSelected(getBindStatus(), resolvedValue); }
private static boolean mapCompare(Map<?, ?> boundMap, Object candidateValue, BindStatus bindStatus) { try { if (boundMap.containsKey(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeMap - ignore. } return exhaustiveCollectionCompare(boundMap.keySet(), candidateValue, bindStatus); }
/** * Determines whether the supplied value matched the selected value * through delegating to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(@Nullable Object value) throws JspException { return SelectedValueComparator.isSelected(getBindStatus(), value); }
private static boolean collectionCompare(Collection<?> boundCollection, Object candidateValue, BindStatus bindStatus) { try { if (boundCollection.contains(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeSet - ignore. } return exhaustiveCollectionCompare(boundCollection, candidateValue, bindStatus); }
private boolean isSelected(Object resolvedValue) { return SelectedValueComparator.isSelected(getBindStatus(), resolvedValue); }
private static boolean mapCompare(Map<?, ?> boundMap, Object candidateValue, BindStatus bindStatus) { try { if (boundMap.containsKey(candidateValue)) { return true; } } catch (ClassCastException ex) { // Probably from a TreeMap - ignore. } return exhaustiveCollectionCompare(boundMap.keySet(), candidateValue, bindStatus); }
/** * Determine whether the supplied values matched the selected value. * <p>Delegates to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(Object resolvedValue) { return SelectedValueComparator.isSelected(this.bindStatus, resolvedValue); }
public static boolean isSelected(final BindStatus bindStatus, final Object candidateValue) { return SelectedValueComparator.isSelected(bindStatus, candidateValue); }