|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.web.servlet.tags.form.SelectedValueComparator
abstract class SelectedValueComparator
Utility class for testing whether a candidate value matches a data bound value.
Eagerly attempts to prove a comparison through a number of avenues to deal with issues such as instance
inequality, logical (String-representation-based) equality and PropertyEditor-based comparison.
Full support is provided for comparing arrays, Collections and Maps.
Java equality. As
such, user code should endeavour to implement Object.equals(java.lang.Object) to speed up the comparison process. If
Object.equals(java.lang.Object) returns false then an attempt is made at an
exhaustive comparison with the aim being to prove equality rather
than disprove it.
Special support is given for instances of LabeledEnum with a String-based
comparison of the candidate value against the code of the LabeledEnum. This can be useful when a
LabeledEnum is used to define a list of '<option>' elements in HTML.
Next, an attempt is made to compare the String representations of both the candidate and bound
values. This may result in true in a number of cases due to the fact both values will be represented
as Strings when shown to the user.
Next, if the candidate value is a String, an attempt is made to compare the bound value to
result of applying the corresponding PropertyEditor to the candidate. This comparison may be
executed twice, once against the direct String instances, and then against the String
representations if the first comparison results in false.
| Constructor Summary | |
|---|---|
SelectedValueComparator()
|
|
| Method Summary | |
|---|---|
static boolean |
isSelected(BindStatus bindStatus,
Object candidateValue)
Returns true if the supplied candidate value is equal to the value bound to
the supplied BindStatus. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
SelectedValueComparator()
| Method Detail |
|---|
public static boolean isSelected(BindStatus bindStatus,
Object candidateValue)
true if the supplied candidate value is equal to the value bound to
the supplied BindStatus. Equality in this case differs from standard Java equality and
is described in more detail here.
|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||