SWF-1250 Replace extensions of deprecated LabeledEnum with Java 5 enum instead of having a StringToLabeledEnumConverter registered with the ConversionService
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Fri Feb 13 15:52:19 EST 2009
|
||||
#Wed Jun 09 09:16:13 BST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||
@@ -9,22 +9,22 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
@@ -79,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.enums.LabeledEnum;
|
||||
|
||||
/**
|
||||
* Default, local implementation of a conversion service. Will automatically register <i>from string</i> converters for
|
||||
@@ -75,7 +74,6 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
addAlias("bigDecimal", BigDecimal.class);
|
||||
addAlias("locale", Locale.class);
|
||||
addAlias("date", Date.class);
|
||||
addAlias("labeledEnum", LabeledEnum.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.binding.message;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
|
||||
/**
|
||||
* Enum exposing supported message severities.
|
||||
*
|
||||
@@ -24,30 +22,27 @@ import org.springframework.core.enums.StaticLabeledEnum;
|
||||
* @author Jeremy Grelle
|
||||
* @see Message
|
||||
*/
|
||||
public class Severity extends StaticLabeledEnum {
|
||||
public enum Severity {
|
||||
|
||||
/**
|
||||
* The "Informational" severity. Used to indicate a successful operation or result.
|
||||
*/
|
||||
public static final Severity INFO = new Severity(0, "Info");
|
||||
INFO,
|
||||
|
||||
/**
|
||||
* The "Warning" severity. Used to indicate there is a minor problem, or to inform the message receiver of possible
|
||||
* misuse, or to indicate a problem may arise in the future.
|
||||
*/
|
||||
public static final Severity WARNING = new Severity(1, "Warning");
|
||||
WARNING,
|
||||
|
||||
/**
|
||||
* The "Error" severity. Used to indicate a significant problem like a business rule violation.
|
||||
*/
|
||||
public static final Severity ERROR = new Severity(2, "Error");
|
||||
ERROR,
|
||||
|
||||
/**
|
||||
* The "Fatal" severity. Used to indicate a fatal problem like a system error.
|
||||
*/
|
||||
public static final Severity FATAL = new Severity(3, "Fatal");
|
||||
FATAL
|
||||
|
||||
private Severity(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Thu Jul 10 09:40:30 BST 2008
|
||||
#Wed Jun 09 09:15:58 BST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||
@@ -9,22 +9,22 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
@@ -79,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Thu Jul 10 09:39:53 BST 2008
|
||||
#Wed Jun 09 09:15:34 BST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||
@@ -9,22 +9,22 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
@@ -79,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
|
||||
@@ -15,34 +15,28 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
|
||||
/**
|
||||
* View state history policies.
|
||||
*
|
||||
* @see ViewState
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class History extends StaticLabeledEnum {
|
||||
public enum History {
|
||||
|
||||
/**
|
||||
* The history of the view state should be preserved when the view state exits to support back-tracking.
|
||||
*/
|
||||
public static final History PRESERVE = new History(0, "preserve");
|
||||
PRESERVE,
|
||||
|
||||
/**
|
||||
* The history of the view state should be discarded when the view state exits to prevent back-tracking.
|
||||
*/
|
||||
public static final History DISCARD = new History(1, "discard");
|
||||
DISCARD,
|
||||
|
||||
/**
|
||||
* The history of the view state and all previous view state should be invalidated to completely restrict back
|
||||
* tracking.
|
||||
*/
|
||||
public static final History INVALIDATE = new History(2, "invalidate");
|
||||
|
||||
private History(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
INVALIDATE
|
||||
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder {
|
||||
attributes.put("validate", fromStringTo(Boolean.class).execute(transition.getValidate()));
|
||||
}
|
||||
if (StringUtils.hasText(transition.getHistory())) {
|
||||
attributes.put("history", fromStringTo(History.class).execute(transition.getHistory()));
|
||||
attributes.put("history", fromStringTo(History.class).execute(transition.getHistory().toUpperCase()));
|
||||
}
|
||||
parseAndPutSecured(transition.getSecured(), attributes);
|
||||
return getLocalContext().getFlowArtifactFactory().createTransition(stateResolver, matchingCriteria,
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
package org.springframework.webflow.engine.impl;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
|
||||
/**
|
||||
* A enum used internally by {@link FlowExecutionImpl} to track its status. Flow Executions initially start out in
|
||||
* NOT_STARTED. After start is called, they are ACTIVE. After ending, their status is updated to ENDED.
|
||||
*/
|
||||
public class FlowExecutionStatus extends StaticLabeledEnum {
|
||||
public enum FlowExecutionStatus {
|
||||
|
||||
/**
|
||||
* The flow execution has not yet started.
|
||||
*/
|
||||
public static final FlowExecutionStatus NOT_STARTED = new FlowExecutionStatus(0, "Not Started");
|
||||
NOT_STARTED,
|
||||
|
||||
/**
|
||||
* The flow execution has started and a session is active.
|
||||
*/
|
||||
public static final FlowExecutionStatus ACTIVE = new FlowExecutionStatus(1, "Active");
|
||||
ACTIVE,
|
||||
|
||||
/**
|
||||
* The flow execution has ended.
|
||||
*/
|
||||
public static final FlowExecutionStatus ENDED = new FlowExecutionStatus(2, "Ended");
|
||||
|
||||
private FlowExecutionStatus(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
ENDED
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.execution;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
import org.springframework.webflow.core.collection.MutableAttributeMap;
|
||||
import org.springframework.webflow.definition.FlowDefinition;
|
||||
|
||||
@@ -29,17 +28,17 @@ import org.springframework.webflow.definition.FlowDefinition;
|
||||
* @author Keith Donald
|
||||
* @author Erwin Vervaet
|
||||
*/
|
||||
public abstract class ScopeType extends StaticLabeledEnum {
|
||||
public enum ScopeType {
|
||||
|
||||
/**
|
||||
* The "request" scope type. Attributes placed in request scope exist for the life of the current request into the
|
||||
* flow execution. When the request ends any attributes in request scope go out of scope.
|
||||
*/
|
||||
public static final ScopeType REQUEST = new ScopeType(0, "Request") {
|
||||
REQUEST() {
|
||||
public MutableAttributeMap getScope(RequestContext context) {
|
||||
return context.getRequestScope();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* The "flash" scope type. Attributes placed in flash scope exist through the life of the current request <i>and
|
||||
@@ -47,11 +46,11 @@ public abstract class ScopeType extends StaticLabeledEnum {
|
||||
* <p>
|
||||
* Flash scope is typically used to store messages that should be preserved until after the next view renders.
|
||||
*/
|
||||
public static final ScopeType FLASH = new ScopeType(1, "Flash") {
|
||||
FLASH() {
|
||||
public MutableAttributeMap getScope(RequestContext context) {
|
||||
return context.getFlashScope();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* The "view" scope type. Attributes placed in view scope exist through the life of the current view state <i>and
|
||||
@@ -59,40 +58,34 @@ public abstract class ScopeType extends StaticLabeledEnum {
|
||||
* <p>
|
||||
* View scope is typically used to store view model objects manipulated over a series of Ajax requests.
|
||||
*/
|
||||
public static final ScopeType VIEW = new ScopeType(1, "View") {
|
||||
VIEW() {
|
||||
public MutableAttributeMap getScope(RequestContext context) {
|
||||
return context.getViewScope();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* The "flow" scope type. Attributes placed in flow scope exist through the life of an executing flow session,
|
||||
* representing an instance a single {@link FlowDefinition flow definition}. When the flow session ends any data in
|
||||
* flow scope goes out of scope.
|
||||
*/
|
||||
public static final ScopeType FLOW = new ScopeType(2, "Flow") {
|
||||
FLOW() {
|
||||
public MutableAttributeMap getScope(RequestContext context) {
|
||||
return context.getFlowScope();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* The "conversation" scope type. Attributes placed in conversation scope are shared by all flow sessions started
|
||||
* within a flow execution and live for the life of the entire flow execution (representing a single logical user
|
||||
* conversation). When the governing execution ends, any data in conversation scope goes out of scope.
|
||||
*/
|
||||
public static final ScopeType CONVERSATION = new ScopeType(3, "Conversation") {
|
||||
CONVERSATION() {
|
||||
public MutableAttributeMap getScope(RequestContext context) {
|
||||
return context.getConversationScope();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Private constructor because this is a typesafe enum!
|
||||
*/
|
||||
private ScopeType(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
|
||||
public Class getType() {
|
||||
// force ScopeType as type
|
||||
return ScopeType.class;
|
||||
@@ -104,4 +97,5 @@ public abstract class ScopeType extends StaticLabeledEnum {
|
||||
* @return the scope map of this type for that request, allowing attributes to be accessed and set
|
||||
*/
|
||||
public abstract MutableAttributeMap getScope(RequestContext context);
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.webflow.mvc.builder;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.portlet.context.ConfigurablePortletApplicationContext;
|
||||
@@ -26,21 +25,17 @@ import org.springframework.web.portlet.context.ConfigurablePortletApplicationCon
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class MvcEnvironment extends StaticLabeledEnum {
|
||||
public enum MvcEnvironment {
|
||||
|
||||
/**
|
||||
* Spring Web Servlet MVC.
|
||||
*/
|
||||
public static final MvcEnvironment SERVLET = new MvcEnvironment(0, "servlet");
|
||||
SERVLET,
|
||||
|
||||
/**
|
||||
* Spring Web Portlet MVC.
|
||||
*/
|
||||
public static final MvcEnvironment PORTLET = new MvcEnvironment(1, "portlet");
|
||||
|
||||
private MvcEnvironment(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
PORTLET;
|
||||
|
||||
/**
|
||||
* Calculates the web environment from the state of the provided application context.
|
||||
|
||||
@@ -31,11 +31,11 @@ import org.springframework.webflow.execution.ScopeType;
|
||||
public class ScopeRegistrar implements BeanFactoryPostProcessor, Ordered {
|
||||
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
beanFactory.registerScope(ScopeType.REQUEST.getLabel().toLowerCase(), new RequestScope());
|
||||
beanFactory.registerScope(ScopeType.FLASH.getLabel().toLowerCase(), new FlashScope());
|
||||
beanFactory.registerScope(ScopeType.VIEW.getLabel().toLowerCase(), new ViewScope());
|
||||
beanFactory.registerScope(ScopeType.FLOW.getLabel().toLowerCase(), new FlowScope());
|
||||
beanFactory.registerScope(ScopeType.CONVERSATION.getLabel().toLowerCase(), new ConversationScope());
|
||||
beanFactory.registerScope(ScopeType.REQUEST.name().toLowerCase(), new RequestScope());
|
||||
beanFactory.registerScope(ScopeType.FLASH.name().toLowerCase(), new FlashScope());
|
||||
beanFactory.registerScope(ScopeType.VIEW.name().toLowerCase(), new ViewScope());
|
||||
beanFactory.registerScope(ScopeType.FLOW.name().toLowerCase(), new FlowScope());
|
||||
beanFactory.registerScope(ScopeType.CONVERSATION.name().toLowerCase(), new ConversationScope());
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.Date;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.test.MockRequestContext;
|
||||
|
||||
@@ -50,17 +49,8 @@ public class ResultObjectBasedEventFactoryTests extends TestCase {
|
||||
assertSame(MyLabeledEnum.A, event.getAttributes().get("result"));
|
||||
}
|
||||
|
||||
public static class MyLabeledEnum extends StaticLabeledEnum {
|
||||
public static final MyLabeledEnum A = new MyLabeledEnum(0, "A");
|
||||
public static final MyLabeledEnum B = new MyLabeledEnum(0, "B");
|
||||
|
||||
private MyLabeledEnum(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "MyLabeledEnum " + getLabel();
|
||||
}
|
||||
public static enum MyLabeledEnum {
|
||||
A, B;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.webflow.action;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.core.enums.StaticLabeledEnum;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.test.MockRequestContext;
|
||||
|
||||
@@ -58,7 +57,7 @@ public class ResultObjectEventFactoryTests extends TestCase {
|
||||
|
||||
public void testLabeledEnumResult() {
|
||||
Event result = factory.createResultEvent(this, MyEnum.FOO, context);
|
||||
assertEquals("foo", result.getId());
|
||||
assertEquals("FOO", result.getId());
|
||||
}
|
||||
|
||||
public void testOtherResult() {
|
||||
@@ -66,12 +65,8 @@ public class ResultObjectEventFactoryTests extends TestCase {
|
||||
assertEquals("hello", result.getId());
|
||||
}
|
||||
|
||||
private static class MyEnum extends StaticLabeledEnum {
|
||||
public static final MyEnum FOO = new MyEnum();
|
||||
|
||||
private MyEnum() {
|
||||
super(1, "foo");
|
||||
}
|
||||
private static enum MyEnum {
|
||||
FOO;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user