1 /*
2 * Copyright 2009-2013 Stephen Colebourne
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.joda.money.format;
17
18 import java.util.Locale;
19
20 /**
21 * Context used when printing money.
22 * <p>
23 * This class is mutable and intended for use by a single thread.
24 * A new instance is created for each parse.
25 */
26 public final class MoneyPrintContext {
27
28 /**
29 * The locale to print using.
30 */
31 private Locale locale;
32
33 /**
34 * Constructor.
35 *
36 * @param locale the locale, not null
37 */
38 MoneyPrintContext(Locale locale) {
39 this.locale = locale;
40 }
41
42 //-----------------------------------------------------------------------
43 /**
44 * Gets the locale.
45 *
46 * @return the locale, never null
47 */
48 public Locale getLocale() {
49 return locale;
50 }
51
52 /**
53 * Sets the locale.
54 *
55 * @param locale the locale, not null
56 */
57 public void setLocale(Locale locale) {
58 MoneyFormatter.checkNotNull(locale, "Locale must not be null");
59 this.locale = locale;
60 }
61
62 }