1 /*
2 * Copyright 2001-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.time.chrono;
17
18 import java.util.Locale;
19
20 /**
21 * Provides time calculations for the month of the year component of time.
22 *
23 * @author Guy Allard
24 * @author Stephen Colebourne
25 * @author Brian S O'Neill
26 * @since 1.0
27 */
28 final class GJMonthOfYearDateTimeField extends BasicMonthOfYearDateTimeField {
29
30 /** Serialization version */
31 @SuppressWarnings("unused")
32 private static final long serialVersionUID = -4748157875845286249L;
33
34 /**
35 * Restricted constructor
36 */
37 GJMonthOfYearDateTimeField(BasicChronology chronology) {
38 super(chronology, 2);
39 }
40
41 //-----------------------------------------------------------------------
42 public String getAsText(int fieldValue, Locale locale) {
43 return GJLocaleSymbols.forLocale(locale).monthOfYearValueToText(fieldValue);
44 }
45
46 //-----------------------------------------------------------------------
47 public String getAsShortText(int fieldValue, Locale locale) {
48 return GJLocaleSymbols.forLocale(locale).monthOfYearValueToShortText(fieldValue);
49 }
50
51 //-----------------------------------------------------------------------
52 protected int convertText(String text, Locale locale) {
53 return GJLocaleSymbols.forLocale(locale).monthOfYearTextToValue(text);
54 }
55
56 //-----------------------------------------------------------------------
57 public int getMaximumTextLength(Locale locale) {
58 return GJLocaleSymbols.forLocale(locale).getMonthMaxTextLength();
59 }
60
61 //-----------------------------------------------------------------------
62 public int getMaximumShortTextLength(Locale locale) {
63 return GJLocaleSymbols.forLocale(locale).getMonthMaxShortTextLength();
64 }
65
66 }
67