public abstract class LocalizationFeature extends Object implements org.graalvm.nativeimage.hosted.Feature
LocalizationSupport or one of its
subtypes.
In case of ResourceBundles, one can also specify how bundles should be handled, because currently
there are two different modes.
The first approach is using a simple in memory map instead of the original JDK lookup. This
simpler implementation leads to image size savings for smaller images such as hello world, but
could cause compatibility issues and maintenance overhead. It is implemented in
OptimizedLocalizationSupport.
The second approach relies on the original JVM implementation instead. This approach is
consistent by design, which solves compatibility issues and reduces maintenance overhead.
Unfortunately, the default way of storing bundle data in getContents methods, see
sun.text.resources.FormatData for example, is not very AOT friendly. Compiling these
methods is time consuming and results in a bloated image (183 MB HelloWorld with all locales).
Therefore, the bundle content itself is again stored in the image heap by default and furthermore
is compressed to reduce the image size, see BundleContentSubstitutedLocalizationSupport
and GzipBundleCompression.| Modifier and Type | Class and Description |
|---|---|
static class |
LocalizationFeature.CharsetNodePlugin
Many subclasses of
Charset initialize encoding and decoding tables lazily. |
static class |
LocalizationFeature.Options |
org.graalvm.nativeimage.hosted.Feature.AfterAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.AfterCompilationAccess, org.graalvm.nativeimage.hosted.Feature.AfterHeapLayoutAccess, org.graalvm.nativeimage.hosted.Feature.AfterImageWriteAccess, org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess, org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.BeforeCompilationAccess, org.graalvm.nativeimage.hosted.Feature.BeforeImageWriteAccess, org.graalvm.nativeimage.hosted.Feature.BeforeUniverseBuildingAccess, org.graalvm.nativeimage.hosted.Feature.CompilationAccess, org.graalvm.nativeimage.hosted.Feature.DuringAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.DuringSetupAccess, org.graalvm.nativeimage.hosted.Feature.FeatureAccess, org.graalvm.nativeimage.hosted.Feature.IsInConfigurationAccess, org.graalvm.nativeimage.hosted.Feature.OnAnalysisExitAccess, org.graalvm.nativeimage.hosted.Feature.QueryReachabilityAccess| Modifier and Type | Field and Description |
|---|---|
protected Set<Locale> |
allLocales |
protected Locale |
defaultLocale
The Locale that the native image is built for.
|
protected boolean |
optimizedMode |
protected LocalizationSupport |
support |
protected boolean |
trace |
| Constructor and Description |
|---|
LocalizationFeature() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addCharset(Charset charset) |
protected void |
addResourceBundles() |
void |
afterAnalysis(org.graalvm.nativeimage.hosted.Feature.AfterAnalysisAccess access) |
void |
afterRegistration(org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess access) |
void |
beforeAnalysis(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access) |
void |
duringSetup(org.graalvm.nativeimage.hosted.Feature.DuringSetupAccess access) |
protected List<Class<? extends LocaleServiceProvider>> |
getSpiClasses() |
protected sun.util.resources.LocaleData |
localeData(Class<? extends LocaleServiceProvider> providerClass,
Locale locale) |
protected void |
prepareBundle(ResourceBundle bundle,
Locale locale) |
void |
prepareBundle(String baseName) |
void |
prepareBundle(String baseName,
Collection<Locale> wantedLocales) |
void |
prepareClassResourceBundle(String basename,
String className) |
protected void |
trace(String msg) |
protected final boolean optimizedMode
protected final boolean trace
protected Locale defaultLocale
protected LocalizationSupport support
public void afterRegistration(org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess access)
afterRegistration in interface org.graalvm.nativeimage.hosted.Featurepublic void duringSetup(org.graalvm.nativeimage.hosted.Feature.DuringSetupAccess access)
duringSetup in interface org.graalvm.nativeimage.hosted.Featurepublic void beforeAnalysis(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access)
beforeAnalysis in interface org.graalvm.nativeimage.hosted.Featurepublic void afterAnalysis(org.graalvm.nativeimage.hosted.Feature.AfterAnalysisAccess access)
afterAnalysis in interface org.graalvm.nativeimage.hosted.Featurepublic static void addCharset(Charset charset)
protected List<Class<? extends LocaleServiceProvider>> getSpiClasses()
protected void addResourceBundles()
protected sun.util.resources.LocaleData localeData(Class<? extends LocaleServiceProvider> providerClass, Locale locale)
public void prepareClassResourceBundle(String basename, String className)
public void prepareBundle(String baseName)
public void prepareBundle(String baseName, Collection<Locale> wantedLocales)
protected void prepareBundle(ResourceBundle bundle, Locale locale)
protected void trace(String msg)