1f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes/* 2c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Licensed to the Apache Software Foundation (ASF) under one or more 3c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * contributor license agreements. See the NOTICE file distributed with 4c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * this work for additional information regarding copyright ownership. 5c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 6c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * (the "License"); you may not use this file except in compliance with 7c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * the License. You may obtain a copy of the License at 8f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 9c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 10f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 11c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Unless required by applicable law or agreed to in writing, software 12c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 13c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * See the License for the specific language governing permissions and 15c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * limitations under the License. 16c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 17c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 18c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughespackage java.text.spi; 19c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 20c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughesimport java.text.DateFormat; 21c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughesimport java.util.Locale; 22c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughesimport java.util.spi.LocaleServiceProvider; 23c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 24c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes/** 25c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * This abstract class should be extended by service providers that provide 26c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * instances of {@code DateFormat}. 27d2d7abef3e9b73a57cdf1f2afd678d7f48945679Elliott Hughes * <p>Note that Android does not support user-supplied locale service providers. 28c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @since 1.6 29c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @hide 30c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 31c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughespublic abstract class DateFormatProvider extends LocaleServiceProvider { 32c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes /** 33c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Default constructor, for use by subclasses. 34c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 35c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes protected DateFormatProvider() { 36c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes // Do nothing. 37c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes } 38c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 39c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes /** 40c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Returns an instance of {@code DateFormat} that formats times 41c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * in the given style for the given locale. 42f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 43c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param style the given time formatting style. 44c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param locale the locale 45c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @return an instance of {@code DateFormat} 46c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws NullPointerException if {@code locale == null} 47c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws IllegalArgumentException 48c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * if locale isn't one of the locales returned from 49c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * getAvailableLocales(). 50c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 51c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes public abstract DateFormat getTimeInstance(int style, Locale locale); 52c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 53c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes /** 54c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Returns an instance of {@code DateFormat} that formats dates 55c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * in the given style for the given locale. 56f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 57c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param style the given date formatting style. 58c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param locale the locale 59c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @return an instance of {@code DateFormat} 60c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws NullPointerException if {@code locale == null} 61c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws IllegalArgumentException 62c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * if locale isn't one of the locales returned from 63c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * getAvailableLocales(). 64c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 65c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes public abstract DateFormat getDateInstance(int style, Locale locale); 66c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes 67c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes /** 68c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * Returns an instance of {@code DateFormat} that formats dates and times 69c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * in the given style for the given locale. 70f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 71c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param dateStyle the given date formatting style. 72c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param timeStyle the given time formatting style. 73c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @param locale the locale 74c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @return an instance of {@code DateFormat} 75c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws NullPointerException if {@code locale == null} 76c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @throws IllegalArgumentException 77c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * if locale isn't one of the locales returned from 78c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * getAvailableLocales(). 79c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */ 80c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes public abstract DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale); 81c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes} 82