public abstract class AbstractNlsBundleFactory extends AbstractComponent implements NlsBundleFactory
NlsBundleFactory.| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractNlsBundleFactory.NlsBundleDescriptor
Interface describing an
NlsBundle interface. |
protected class |
AbstractNlsBundleFactory.NlsBundleInvocationHandler
This inner class is an
InvocationHandler for the dynamic NlsBundle instance. |
protected static class |
AbstractNlsBundleFactory.NlsBundleMethodInfo
This inner class holds all the information to be cached for a
NlsBundle-method. |
| Modifier and Type | Field and Description |
|---|---|
private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> |
bundleDescriptors |
private NlsBundleLocator |
bundleLocator |
private Map<Class<? extends NlsBundle>,NlsBundle> |
bundleMap |
private ClassLoader |
classLoader |
(package private) static String[] |
EMPTY_STRING_ARRAY
An empty
String array. |
private static Object[] |
FAKE_ARGS
An internal trick used for optimization to avoid reflective parameter lookup.
|
private NlsMessageFactory |
messageFactory |
static String |
METHOD_NAME_LOOKUP
The name of the method
NlsBundleWithLookup.getMessage(String, Map). |
(package private) static Pattern |
NLS_BUNDLE_CLASS_NAME_PATTERN |
| Constructor and Description |
|---|
AbstractNlsBundleFactory()
The constructor.
|
AbstractNlsBundleFactory(ClassLoader classLoader)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<BUNDLE extends NlsBundle> |
createBundle(Class<BUNDLE> bundleInterface)
This method dynamically creates an instance for the given
bundleInterface. |
private <BUNDLE extends NlsBundle> |
createBundleInternal(Class<BUNDLE> bundleInterface) |
protected InvocationHandler |
createHandler(Class<? extends NlsBundle> bundleInterface)
This method creates a new
InvocationHandler for the given bundleInterface. |
protected void |
doInitialize() |
protected void |
doInitialized() |
NlsBundleLocator |
getBundleLocator() |
protected NlsBundleOptions |
getBundleOptions(Class<? extends NlsBundle> bundleInterface)
This method gets the
NlsBundleOptions for the given bundleInterface. |
protected NlsMessageFactory |
getMessageFactory() |
Collection<? extends AbstractNlsBundleFactory.NlsBundleDescriptor> |
getNlsBundleDescriptors() |
private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> |
populateNlsBundleDescriptors() |
void |
setBundleLocator(NlsBundleLocator bundleLocator) |
void |
setMessageFactory(NlsMessageFactory messageFactory) |
getInitializationState, initializepublic static final String METHOD_NAME_LOOKUP
NlsBundleWithLookup.getMessage(String, Map).private static final Object[] FAKE_ARGS
static final Pattern NLS_BUNDLE_CLASS_NAME_PATTERN
private final ClassLoader classLoader
private NlsMessageFactory messageFactory
private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> bundleDescriptors
private NlsBundleLocator bundleLocator
public AbstractNlsBundleFactory()
public AbstractNlsBundleFactory(ClassLoader classLoader)
classLoader - is the ClassLoader to use.protected void doInitialize()
doInitialize in class AbstractComponentprotected void doInitialized()
doInitialized in class AbstractComponentprotected NlsMessageFactory getMessageFactory()
NlsMessageFactory.@Inject public void setMessageFactory(NlsMessageFactory messageFactory)
messageFactory - the NlsMessageFactory to Inject.public NlsBundleLocator getBundleLocator()
NlsBundleLocator.@Inject public void setBundleLocator(NlsBundleLocator bundleLocator)
bundleLocator - the NlsBundleLocator to Inject.public <BUNDLE extends NlsBundle> BUNDLE createBundle(Class<BUNDLE> bundleInterface)
NlsBundleFactorybundleInterface.createBundle in interface NlsBundleFactoryBUNDLE - is the generic type of the requested NlsBundle.bundleInterface - the interface of the requested NlsBundle. Has to be a sub-interface of
NlsBundle with according methods.NlsBundle interface.private <BUNDLE extends NlsBundle> BUNDLE createBundleInternal(Class<BUNDLE> bundleInterface)
protected NlsBundleOptions getBundleOptions(Class<? extends NlsBundle> bundleInterface)
NlsBundleOptions for the given bundleInterface. If NOT present a default
instance is returned.bundleInterface - is the Class reflecting the NlsBundle interface.NlsBundleOptions or the default if bundleInterface is NOT annotated
accordingly.protected InvocationHandler createHandler(Class<? extends NlsBundle> bundleInterface)
InvocationHandler for the given bundleInterface.bundleInterface - is the Class reflecting the NlsBundle interface.InvocationHandler for the given bundleInterface.public Collection<? extends AbstractNlsBundleFactory.NlsBundleDescriptor> getNlsBundleDescriptors()
Collection of AbstractNlsBundleFactory.NlsBundleDescriptors for all NlsBundle-interfaces on the classpath
following the suggested naming convention NlsBundle*Root.private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> populateNlsBundleDescriptors()
Copyright © 2001–2019 mmm-Team. All rights reserved.