|
41 | 41 | * and methods for name retrieval in the {@code java.text} and
|
42 | 42 | * {@code java.util} packages use implementations of the provider
|
43 | 43 | * interfaces to offer support for locales beyond the set of locales
|
44 |
| - * supported by the Java runtime environment itself. |
| 44 | + * supported by the Java runtime environment itself. Locale sensitive service |
| 45 | + * providers are deployed on the application module path or the application class |
| 46 | + * path. In order to be looked up, providers must be visible to the {@link |
| 47 | + * ClassLoader#getSystemClassLoader() system class loader}. |
| 48 | + * See {@link java.util.ServiceLoader##developing-service-providers Deploying |
| 49 | + * Service Providers} for further detail on deploying a locale sensitive service |
| 50 | + * provider as a module or on the class path. |
45 | 51 | *
|
46 | 52 | * <h2>Packaging of Locale Sensitive Service Provider Implementations</h2>
|
47 |
| - * Implementations of these locale sensitive services can be made available |
48 |
| - * by adding them to the application's class path. A provider identifies itself with a |
49 |
| - * provider-configuration file in the resource directory META-INF/services, |
50 |
| - * using the fully qualified provider interface class name as the file name. |
51 |
| - * The file should contain a list of fully-qualified concrete provider class names, |
52 |
| - * one per line. A line is terminated by any one of a line feed ('\n'), a carriage |
53 |
| - * return ('\r'), or a carriage return followed immediately by a line feed. Space |
54 |
| - * and tab characters surrounding each name, as well as blank lines, are ignored. |
55 |
| - * The comment character is '#' ('\u0023'); on each line all characters following |
56 |
| - * the first comment character are ignored. The file must be encoded in UTF-8. |
| 53 | + * |
| 54 | + * <p> For a locale sensitive service provider deployed in a module, the <i>provides</i> |
| 55 | + * directive must be specified in the module declaration. The <i>provides</i> |
| 56 | + * directive specifies both the service and the service provider. |
| 57 | + * |
| 58 | + * <p> For example, an implementation of the {@link java.text.spi.DateFormatProvider |
| 59 | + * DateFormatProvider} class deployed as a module might specify the following directive: |
| 60 | + * <pre>{@code |
| 61 | + * provides java.text.spi.DateFormatProvider with com.example.ExternalDateFormatProvider; |
| 62 | + * }</pre> |
| 63 | + * |
| 64 | + * <p> For a Locale Service Provider deployed on the class path, the provider |
| 65 | + * identifies itself with a provider-configuration file in the resource directory |
| 66 | + * META-INF/services. The file name should be the fully fully qualified provider |
| 67 | + * interface class name. The file should contain a list of fully-qualified concrete |
| 68 | + * provider class names, one per line. A line is terminated by any one of a line |
| 69 | + * feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately |
| 70 | + * by a line feed. Space and tab characters surrounding each name, as well as |
| 71 | + * blank lines, are ignored. The comment character is '#' ('\u0023'); on each line |
| 72 | + * all characters following the first comment character are ignored. The file must |
| 73 | + * be encoded in UTF-8. |
57 | 74 | * <p>
|
58 | 75 | * If a particular concrete provider class is named in more than one configuration
|
59 | 76 | * file, or is named in the same configuration file more than once, then the
|
|
88 | 105 | * supports the requested locale. If such a provider is found, its other
|
89 | 106 | * methods are called to obtain the requested object or name. When checking
|
90 | 107 | * whether a locale is supported, the {@linkplain Locale##def_extensions
|
91 |
| - * locale's extensions} are ignored by default. (If locale's extensions should |
92 |
| - * also be checked, the {@code isSupportedLocale} method must be overridden.) |
| 108 | + * locale's extensions} are ignored by default. (If a locale's extensions should |
| 109 | + * also be checked, the {@code isSupportedLocale} method must be overridden). |
93 | 110 | * If neither the Java runtime environment itself nor an installed provider
|
94 | 111 | * supports the requested locale, the methods go through a list of candidate
|
95 | 112 | * locales and repeat the availability check for each until a match is found.
|
|
0 commit comments