Browse Source
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1627 50f2f4bb-b051-0410-bef5-90022cba6387pull/1/head
8 changed files with 134 additions and 38 deletions
@ -0,0 +1,16 @@ |
|||||||
|
package org.springframework.model.message; |
||||||
|
|
||||||
|
/** |
||||||
|
* A factory for a default message to return if no message could be resolved. |
||||||
|
* Allows the message String to be created lazily, only when it is needed. |
||||||
|
* @author Keith Donald |
||||||
|
* @since 3.0 |
||||||
|
* @see MessageBuilder |
||||||
|
*/ |
||||||
|
public interface DefaultMessageFactory { |
||||||
|
|
||||||
|
/** |
||||||
|
* Create the default message. |
||||||
|
*/ |
||||||
|
String createDefaultMessage(); |
||||||
|
} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2004-2009 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.model.message; |
||||||
|
|
||||||
|
class StaticDefaultMessageFactory implements DefaultMessageFactory { |
||||||
|
|
||||||
|
private String defaultMessage; |
||||||
|
|
||||||
|
public StaticDefaultMessageFactory(String defaultMessage) { |
||||||
|
this.defaultMessage = defaultMessage; |
||||||
|
} |
||||||
|
|
||||||
|
public String createDefaultMessage() { |
||||||
|
return defaultMessage; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue