diff --git a/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java deleted file mode 100644 index 4a278f92eb..0000000000 --- a/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2002-2012 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.core.enums; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.util.Assert; -import org.springframework.util.CachingMapDecorator; -import org.springframework.util.ClassUtils; - -/** - * Abstract base class for {@link LabeledEnumResolver} implementations, - * caching all retrieved {@link LabeledEnum} instances. - * - *
Subclasses need to implement the template method
- * {@link #findLabeledEnums(Class)}.
- *
- * @author Keith Donald
- * @author Juergen Hoeller
- * @since 1.2.2
- * @see #findLabeledEnums(Class)
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumResolver {
-
- protected transient final Log logger = LogFactory.getLog(getClass());
-
- private final LabeledEnumCache labeledEnumCache = new LabeledEnumCache();
-
-
- public Set Each code should be unique within enumerations of the same type.
- */
- Comparable getCode();
-
- /**
- * Return a descriptive, optional label.
- */
- String getLabel();
-
-
- // Constants for standard enum ordering (Comparator implementations)
-
- /**
- * Shared Comparator instance that sorts enumerations by {@code CODE_ORDER}.
- */
- Comparator CODE_ORDER = new Comparator() {
- public int compare(Object o1, Object o2) {
- Comparable c1 = ((LabeledEnum) o1).getCode();
- Comparable c2 = ((LabeledEnum) o2).getCode();
- return c1.compareTo(c2);
- }
- };
-
- /**
- * Shared Comparator instance that sorts enumerations by {@code LABEL_ORDER}.
- */
- Comparator LABEL_ORDER = new Comparator() {
- public int compare(Object o1, Object o2) {
- LabeledEnum e1 = (LabeledEnum) o1;
- LabeledEnum e2 = (LabeledEnum) o2;
- Comparator comp = new NullSafeComparator(String.CASE_INSENSITIVE_ORDER, true);
- return comp.compare(e1.getLabel(), e2.getLabel());
- }
- };
-
- /**
- * Shared Comparator instance that sorts enumerations by {@code LABEL_ORDER},
- * then {@code CODE_ORDER}.
- */
- Comparator DEFAULT_ORDER =
- new CompoundComparator(new Comparator[] { LABEL_ORDER, CODE_ORDER });
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java
deleted file mode 100644
index 7b374a70b0..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2002-2012 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.core.enums;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Interface for looking up {@code LabeledEnum} instances.
- *
- * @author Keith Donald
- * @author Juergen Hoeller
- * @since 1.2.2
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-public interface LabeledEnumResolver {
-
- /**
- * Return a set of enumerations of a particular type. Each element in the
- * set should be an instance of LabeledEnum.
- * @param type the enum type
- * @return a set of localized enumeration instances for the provided type
- * @throws IllegalArgumentException if the type is not supported
- */
- public Set getLabeledEnumSet(Class type) throws IllegalArgumentException;
-
- /**
- * Return a map of enumerations of a particular type. Each element in the
- * map should be a key/value pair, where the key is the enum code, and the
- * value is the {@code LabeledEnum} instance.
- * @param type the enum type
- * @return a Map of localized enumeration instances,
- * with enum code as key and {@code LabeledEnum} instance as value
- * @throws IllegalArgumentException if the type is not supported
- */
- public Map getLabeledEnumMap(Class type) throws IllegalArgumentException;
-
- /**
- * Resolve a single {@code LabeledEnum} by its identifying code.
- * @param type the enum type
- * @param code the enum code
- * @return the enum
- * @throws IllegalArgumentException if the code did not map to a valid instance
- */
- public LabeledEnum getLabeledEnumByCode(Class type, Comparable code) throws IllegalArgumentException;
-
- /**
- * Resolve a single {@code LabeledEnum} by its identifying code.
- * @param type the enum type
- * @param label the enum label
- * @return the enum
- * @throws IllegalArgumentException if the label did not map to a valid instance
- */
- public LabeledEnum getLabeledEnumByLabel(Class type, String label) throws IllegalArgumentException;
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java
deleted file mode 100644
index cb70971aab..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2002-2012 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.core.enums;
-
-import org.springframework.util.Assert;
-
-/**
- * Implementation of LabeledEnum which uses a letter as the code type.
- *
- * Should almost always be subclassed, but for some simple situations it may be
- * used directly. Note that you will not be able to use unique type-based functionality
- * like {@code LabeledEnumResolver.getLabeledEnumSet(type)} in this case.
- *
- * @author Keith Donald
- * @since 1.2.2
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-@SuppressWarnings("serial")
-public class LetterCodedLabeledEnum extends AbstractGenericLabeledEnum {
-
- /**
- * The unique code of this enum.
- */
- private final Character code;
-
-
- /**
- * Create a new LetterCodedLabeledEnum instance.
- * @param code the letter code
- * @param label the label (can be {@code null})
- */
- public LetterCodedLabeledEnum(char code, String label) {
- super(label);
- Assert.isTrue(Character.isLetter(code),
- "The code '" + code + "' is invalid: it must be a letter");
- this.code = new Character(code);
- }
-
-
- public Comparable getCode() {
- return code;
- }
-
- /**
- * Return the letter code of this LabeledEnum instance.
- */
- public char getLetterCode() {
- return ((Character) getCode()).charValue();
- }
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java
deleted file mode 100644
index 27a78d1c66..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2002-2012 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.core.enums;
-
-/**
- * Implementation of LabeledEnum which uses Short as the code type.
- *
- * Should almost always be subclassed, but for some simple situations it may be
- * used directly. Note that you will not be able to use unique type-based functionality
- * like {@code LabeledEnumResolver.getLabeledEnumSet(type)} in this case.
- *
- * @author Keith Donald
- * @since 1.2.2
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-public class ShortCodedLabeledEnum extends AbstractGenericLabeledEnum {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * The unique code of this enum.
- */
- private final Short code;
-
-
- /**
- * Create a new ShortCodedLabeledEnum instance.
- * @param code the short code
- * @param label the label (can be {@code null})
- */
- public ShortCodedLabeledEnum(int code, String label) {
- super(label);
- this.code = new Short((short) code);
- }
-
-
- public Comparable getCode() {
- return code;
- }
-
- /**
- * Return the short code of this LabeledEnum instance.
- */
- public short getShortCode() {
- return ((Short) getCode()).shortValue();
- }
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java
deleted file mode 100644
index e6440cc3b6..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2002-2012 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.core.enums;
-
-/**
- * Base class for static type-safe labeled enum instances.
- *
- * Usage example:
- *
- * Should almost always be subclassed, but for some simple situations it may be
- * used directly. Note that you will not be able to use unique type-based
- * functionality like {@code LabeledEnumResolver.getLabeledEnumSet(type)} in this case.
- *
- * @author Keith Donald
- * @author Juergen Hoeller
- * @since 1.2.2
- * @see org.springframework.core.enums.LabeledEnumResolver#getLabeledEnumSet(Class)
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-@SuppressWarnings("serial")
-public class StringCodedLabeledEnum extends AbstractGenericLabeledEnum {
-
- /**
- * The unique code of this enum.
- */
- private final String code;
-
-
- /**
- * Create a new StringCodedLabeledEnum instance.
- * @param code the String code
- * @param label the label (can be {@code null})
- */
- public StringCodedLabeledEnum(String code, String label) {
- super(label);
- Assert.notNull(code, "'code' must not be null");
- this.code = code;
- }
-
-
- public Comparable getCode() {
- return this.code;
- }
-
- /**
- * Return the String code of this LabeledEnum instance.
- */
- public String getStringCode() {
- return (String) getCode();
- }
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/package-info.java b/spring-core/src/main/java/org/springframework/core/enums/package-info.java
deleted file mode 100644
index ac72053871..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-
-/**
- *
- * Interfaces and classes for type-safe enum support on JDK >= 1.3.
- * This enum abstraction support codes and labels.
- *
- */
-package org.springframework.core.enums;
-
- *
- *
- * @author Keith Donald
- * @since 1.2.2
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-public interface LabeledEnum extends Comparable, Serializable {
-
- /**
- * Return this enumeration's type.
- */
- Class getType();
-
- /**
- * Return this enumeration's code.
- *
- * public class FlowSessionStatus extends StaticLabeledEnum {
- *
- * // public static final instances!
- * public static FlowSessionStatus CREATED = new FlowSessionStatus(0, "Created");
- * public static FlowSessionStatus ACTIVE = new FlowSessionStatus(1, "Active");
- * public static FlowSessionStatus PAUSED = new FlowSessionStatus(2, "Paused");
- * public static FlowSessionStatus SUSPENDED = new FlowSessionStatus(3, "Suspended");
- * public static FlowSessionStatus ENDED = new FlowSessionStatus(4, "Ended");
- *
- * // private constructor!
- * private FlowSessionStatus(int code, String label) {
- * super(code, label);
- * }
- *
- * // custom behavior
- * }
- *
- * @author Keith Donald
- * @since 1.2.6
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-@SuppressWarnings("serial")
-public abstract class StaticLabeledEnum extends AbstractLabeledEnum {
-
- /**
- * The unique code of the enum.
- */
- private final Short code;
-
- /**
- * A descriptive label for the enum.
- */
- private final transient String label;
-
-
- /**
- * Create a new StaticLabeledEnum instance.
- * @param code the short code
- * @param label the label (can be {@code null})
- */
- protected StaticLabeledEnum(int code, String label) {
- this.code = new Short((short) code);
- if (label != null) {
- this.label = label;
- }
- else {
- this.label = this.code.toString();
- }
- }
-
- public Comparable getCode() {
- return code;
- }
-
- public String getLabel() {
- return label;
- }
-
- /**
- * Return the code of this LabeledEnum instance as a short.
- */
- public short shortValue() {
- return ((Number) getCode()).shortValue();
- }
-
-
- //---------------------------------------------------------------------
- // Serialization support
- //---------------------------------------------------------------------
-
- /**
- * Return the resolved type safe static enum instance.
- */
- protected Object readResolve() {
- return StaticLabeledEnumResolver.instance().getLabeledEnumByCode(getType(), getCode());
- }
-
-}
diff --git a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java
deleted file mode 100644
index 3d9f78a402..0000000000
--- a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2002-2012 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.core.enums;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.springframework.util.Assert;
-
-/**
- * {@link LabeledEnumResolver} that resolves statically defined enumerations.
- * Static implies all enum instances were defined within Java code,
- * implementing the type-safe enum pattern.
- *
- * @author Keith Donald
- * @author Juergen Hoeller
- * @since 1.2.2
- * @deprecated as of Spring 3.0, in favor of Java 5 enums.
- */
-@Deprecated
-public class StaticLabeledEnumResolver extends AbstractCachingLabeledEnumResolver {
-
- /**
- * Shared {@code StaticLabeledEnumResolver} singleton instance.
- */
- private static final StaticLabeledEnumResolver INSTANCE = new StaticLabeledEnumResolver();
-
-
- /**
- * Return the shared {@code StaticLabeledEnumResolver} singleton instance.
- * Mainly for resolving unique StaticLabeledEnum references on deserialization.
- * @see StaticLabeledEnum
- */
- public static StaticLabeledEnumResolver instance() {
- return INSTANCE;
- }
-
-
- @Override
- protected Set