Removed deprecated core.enums package
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.enums.LabeledEnum;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.servlet.support.BindStatus;
|
||||
@@ -40,10 +39,6 @@ import org.springframework.web.servlet.support.BindStatus;
|
||||
* {@link #exhaustiveCompare exhaustive comparison} with the aim being to <strong>prove</strong> equality rather
|
||||
* than disprove it.
|
||||
*
|
||||
* <p>Special support is given for instances of {@link LabeledEnum} with a {@code String}-based
|
||||
* comparison of the candidate value against the code of the {@link LabeledEnum}. This can be useful when a
|
||||
* {@link LabeledEnum} is used to define a list of '{@code <option>}' elements in HTML.
|
||||
*
|
||||
* <p>Next, an attempt is made to compare the {@code String} representations of both the candidate and bound
|
||||
* values. This may result in {@code true} in a number of cases due to the fact both values will be represented
|
||||
* as {@code Strings} when shown to the user.
|
||||
@@ -153,18 +148,7 @@ abstract class SelectedValueComparator {
|
||||
PropertyEditor editor, Map<PropertyEditor, Object> convertedValueCache) {
|
||||
|
||||
String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
|
||||
if (boundValue instanceof LabeledEnum) {
|
||||
LabeledEnum labeledEnum = (LabeledEnum) boundValue;
|
||||
String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
|
||||
if (enumCodeAsString.equals(candidateDisplayString)) {
|
||||
return true;
|
||||
}
|
||||
String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
|
||||
if (enumLabelAsString.equals(candidateDisplayString)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (boundValue.getClass().isEnum()) {
|
||||
if (boundValue.getClass().isEnum()) {
|
||||
Enum boundEnum = (Enum) boundValue;
|
||||
String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name());
|
||||
if (enumCodeAsString.equals(candidateDisplayString)) {
|
||||
|
||||
Reference in New Issue
Block a user