Remove all calls to JdkVersion

Java 5 is now a minimum requirement of Web Flow

Issues: SWF-1532
This commit is contained in:
Phillip Webb
2012-04-05 11:02:38 -07:00
parent 58936414e4
commit ca20e95b98
3 changed files with 6 additions and 24 deletions

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.webflow.action;
import org.springframework.core.JdkVersion;
import org.springframework.core.enums.LabeledEnum;
import org.springframework.util.StringUtils;
import org.springframework.webflow.execution.Event;
@@ -78,7 +77,7 @@ public class ResultObjectBasedEventFactory extends EventFactorySupport implement
} else if (isLabeledEnum(resultObject.getClass())) {
String resultId = ((LabeledEnum) resultObject).getLabel();
return event(source, resultId, getResultAttributeName(), resultObject);
} else if (isJdk5Enum(resultObject.getClass())) {
} else if (isEnum(resultObject.getClass())) {
String eventId = EnumUtils.getEnumName(resultObject);
return event(source, eventId, getResultAttributeName(), resultObject);
} else if (isString(resultObject.getClass())) {
@@ -101,7 +100,7 @@ public class ResultObjectBasedEventFactory extends EventFactorySupport implement
* Check whether or not given type is mapped to a corresponding event using special mapping rules.
*/
public boolean isMappedValueType(Class<?> type) {
return isBoolean(type) || isLabeledEnum(type) || isJdk5Enum(type) || isString(type) || isEvent(type);
return isBoolean(type) || isLabeledEnum(type) || isEnum(type) || isString(type) || isEvent(type);
}
// internal helpers to determine the 'type' of a class
@@ -114,12 +113,8 @@ public class ResultObjectBasedEventFactory extends EventFactorySupport implement
return LabeledEnum.class.isAssignableFrom(type);
}
private boolean isJdk5Enum(Class<?> type) {
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
return EnumUtils.isEnum(type);
} else {
return false;
}
private boolean isEnum(Class<?> type) {
return EnumUtils.isEnum(type);
}
private boolean isString(Class<?> type) {

View File

@@ -17,7 +17,6 @@ package org.springframework.webflow.conversation.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.JdkVersion;
/**
* Simple utility class for creating conversation lock instances based on the current execution environment.
@@ -63,15 +62,6 @@ class ConversationLockFactory {
* lock is returned.
*/
public ConversationLock createLock() {
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
return new JdkConcurrentConversationLock(timeoutSeconds);
} else if (backportConcurrentPresent) {
return new JdkBackportConcurrentConversationLock(timeoutSeconds);
} else {
logger.warn("Unable to enable conversation locking. Switch to Java 5 or above, "
+ "or put the 'backport-util-concurrent' package on the classpath "
+ "to enable locking in your Java 1.4 environment.");
return NoOpConversationLock.INSTANCE;
}
return new JdkConcurrentConversationLock(timeoutSeconds);
}
}

View File

@@ -38,7 +38,6 @@ import org.springframework.context.annotation.AnnotationConfigUtils;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.JdkVersion;
import org.springframework.core.io.Resource;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
@@ -338,9 +337,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder {
flowContext.getBeanFactory().registerScope("conversation", new ConversationScope());
Resource flowResource = flowModelHolder.getFlowModelResource();
flowContext.setResourceLoader(new FlowRelativeResourceLoader(flowResource));
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
AnnotationConfigUtils.registerAnnotationConfigProcessors(flowContext);
}
AnnotationConfigUtils.registerAnnotationConfigProcessors(flowContext);
new XmlBeanDefinitionReader(flowContext).loadBeanDefinitions(resources);
registerFlowBeans(flowContext.getBeanFactory());
registerMessageSource(flowContext, flowResource);