message system polish

This commit is contained in:
Keith Donald
2008-05-14 03:22:35 +00:00
parent 7010a806a0
commit bfa6b0cd39
4 changed files with 11 additions and 10 deletions

View File

@@ -34,7 +34,8 @@ import org.springframework.core.style.ToStringCreator;
import org.springframework.util.CachingMapDecorator; import org.springframework.util.CachingMapDecorator;
/** /**
* Default message context implementation. * The default message context implementation. Uses a {@link MessageSource} to resolve messages that are added by
* callers.
* *
* @author Keith Donald * @author Keith Donald
*/ */
@@ -51,7 +52,8 @@ public class DefaultMessageContext implements StateManageableMessageContext {
}; };
/** /**
* Creates a new default message context. * Creates a new default message context. Defaults to a message source that simply resolves default text and cannot
* resolve localized message codes.
*/ */
public DefaultMessageContext() { public DefaultMessageContext() {
init(null); init(null);
@@ -59,7 +61,7 @@ public class DefaultMessageContext implements StateManageableMessageContext {
/** /**
* Creates a new default message context. * Creates a new default message context.
* @param messageSource the message source to resolve messages added to this context (may be null) * @param messageSource the message source to resolve messages added to this context
*/ */
public DefaultMessageContext(MessageSource messageSource) { public DefaultMessageContext(MessageSource messageSource) {
init(messageSource); init(messageSource);

View File

@@ -42,7 +42,8 @@ public interface StateManageableMessageContext extends MessageContext {
public void restoreMessages(Serializable messagesMemento); public void restoreMessages(Serializable messagesMemento);
/** /**
* Configure the message source used to resolve messages added to this context. * Configure the message source used to resolve messages added to this context. May be set at any time to change how
* coded messages are resolved.
* @param messageSource the message source * @param messageSource the message source
* @see MessageContext#addMessage(MessageResolver) * @see MessageContext#addMessage(MessageResolver)
*/ */

View File

@@ -7,7 +7,7 @@ import junit.framework.TestCase;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
public class DefaultMessageContextFactoryTests extends TestCase { public class DefaultMessageContextTests extends TestCase {
private DefaultMessageContext context; private DefaultMessageContext context;
protected void setUp() { protected void setUp() {

View File

@@ -54,7 +54,6 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory {
* @param executionAttributes flow execution system attributes * @param executionAttributes flow execution system attributes
*/ */
public void setExecutionAttributes(AttributeMap executionAttributes) { public void setExecutionAttributes(AttributeMap executionAttributes) {
Assert.notNull(executionAttributes, "The execution attributes map is required");
this.executionAttributes = executionAttributes; this.executionAttributes = executionAttributes;
} }
@@ -63,7 +62,6 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory {
* over what listeners should apply for executions of a flow definition. * over what listeners should apply for executions of a flow definition.
*/ */
public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader) { public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader) {
Assert.notNull(executionListenerLoader, "The execution listener loader is required");
this.executionListenerLoader = executionListenerLoader; this.executionListenerLoader = executionListenerLoader;
} }
@@ -75,7 +73,7 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory {
} }
public FlowExecution createFlowExecution(FlowDefinition flowDefinition) { public FlowExecution createFlowExecution(FlowDefinition flowDefinition) {
Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of wrong type: "); Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of the wrong type: ");
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Creating new execution of '" + flowDefinition.getId() + "'"); logger.debug("Creating new execution of '" + flowDefinition.getId() + "'");
} }
@@ -89,8 +87,8 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory {
public FlowExecution restoreFlowExecution(FlowExecution flowExecution, FlowDefinition flowDefinition, public FlowExecution restoreFlowExecution(FlowExecution flowExecution, FlowDefinition flowDefinition,
FlowExecutionKey flowExecutionKey, MutableAttributeMap conversationScope, FlowExecutionKey flowExecutionKey, MutableAttributeMap conversationScope,
FlowDefinitionLocator subflowDefinitionLocator) { FlowDefinitionLocator subflowDefinitionLocator) {
Assert.isInstanceOf(FlowExecutionImpl.class, flowExecution, "FlowExecution is of wrong type: "); Assert.isInstanceOf(FlowExecutionImpl.class, flowExecution, "FlowExecution is of the wrong type: ");
Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of wrong type: "); Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of the wrong type: ");
FlowExecutionImpl execution = (FlowExecutionImpl) flowExecution; FlowExecutionImpl execution = (FlowExecutionImpl) flowExecution;
Flow flow = (Flow) flowDefinition; Flow flow = (Flow) flowDefinition;
execution.setFlow(flow); execution.setFlow(flow);