1 /* 2 * Copyright 2001-2005 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 private static final long serialVersionUID = -4748157875845286249L; 32 33 /** 34 * Restricted constructor 35 */ 36 GJMonthOfYearDateTimeField(BasicChronology chronology) { 37 super(chronology, 2); 38 } 39 40 //----------------------------------------------------------------------- 41 public String getAsText(int fieldValue, Locale locale) { 42 return GJLocaleSymbols.forLocale(locale).monthOfYearValueToText(fieldValue); 43 } 44 45 //----------------------------------------------------------------------- 46 public String getAsShortText(int fieldValue, Locale locale) { 47 return GJLocaleSymbols.forLocale(locale).monthOfYearValueToShortText(fieldValue); 48 } 49 50 //----------------------------------------------------------------------- 51 protected int convertText(String text, Locale locale) { 52 return GJLocaleSymbols.forLocale(locale).monthOfYearTextToValue(text); 53 } 54 55 //----------------------------------------------------------------------- 56 public int getMaximumTextLength(Locale locale) { 57 return GJLocaleSymbols.forLocale(locale).getMonthMaxTextLength(); 58 } 59 60 //----------------------------------------------------------------------- 61 public int getMaximumShortTextLength(Locale locale) { 62 return GJLocaleSymbols.forLocale(locale).getMonthMaxShortTextLength(); 63 } 64 65 }