← joda-money  /  src/main/java/org/joda/money/format/MoneyPrintContext.java

1
/*
2
 *  Copyright 2009-present, 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
        MoneyFormatter.checkNotNull(locale, "Locale must not be null");
40
        this.locale = locale;
41
    }
42
43
    //-----------------------------------------------------------------------
44
    /**
45
     * Gets the locale.
46
     *
47
     * @return the locale, never null
48
     */
49
    public Locale getLocale() {
50
        return locale;
51
    }
52
53
    /**
54
     * Sets the locale.
55
     *
56
     * @param locale  the locale, not null
57
     */
58
    public void setLocale(Locale locale) {
59
        MoneyFormatter.checkNotNull(locale, "Locale must not be null");
60
        this.locale = locale;
61
    }
62
63
}
64