01: /*******************************************************************************
02: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
03: * Thomschke.
04: *
05: * All Rights Reserved. This program and the accompanying materials
06: * are made available under the terms of the Eclipse Public License v1.0
07: * which accompanies this distribution, and is available at
08: * http://www.eclipse.org/legal/epl-v10.html
09: *
10: * Contributors:
11: * Sebastian Thomschke - initial implementation.
12: *******************************************************************************/package net.sf.oval.internal;
13:
14: import net.sf.oval.localization.MessageResolver;
15: import net.sf.oval.localization.MessageResolverImpl;
16:
17: /**
18: * The held message resolver is used by OVal to resolve localized messages.
19: *
20: * @author Sebastian Thomschke
21: */
22: public final class MessageResolverHolder {
23: private static MessageResolver messageResolver = MessageResolverImpl.INSTANCE;
24:
25: /**
26: * Returns a shared instance of the MessageResolver
27: */
28: public static MessageResolver getMessageResolver() {
29: return MessageResolverHolder.messageResolver;
30: }
31:
32: /**
33: *
34: * @param messageResolver the new messageResolver to use
35: */
36: public static void setMessageResolver(
37: final MessageResolver messageResolver)
38: throws IllegalArgumentException {
39: if (messageResolver == null)
40: throw new IllegalArgumentException(
41: "messageResolver cannot be null");
42:
43: MessageResolverHolder.messageResolver = messageResolver;
44: }
45: }
|