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 Map<Class<? extends NlsBundle>,NlsBundle> |
bundleMap |
private ClassLoader |
classLoader |
private ClasspathScanner |
classpathScanner |
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). |
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()
This method performs the actual
initialization. |
protected void |
doInitialized()
This method is invoked at the end of the actual
initialization. |
protected NlsBundleOptions |
getBundleOptions(Class<? extends NlsBundle> bundleInterface)
This method gets the
NlsBundleOptions for the given bundleInterface. |
ClasspathScanner |
getClasspathScanner() |
protected NlsMessageFactory |
getMessageFactory() |
Collection<? extends AbstractNlsBundleFactory.NlsBundleDescriptor> |
getNlsBundleDescriptors() |
private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> |
populateNlsBundleDescriptors() |
void |
setClasspathScanner(ClasspathScanner classpathScanner) |
void |
setMessageFactory(NlsMessageFactory messageFactory) |
getInitializationState, initializepublic static final String METHOD_NAME_LOOKUP
NlsBundleWithLookup.getMessage(String, Map).private static final Object[] FAKE_ARGS
private static final Pattern NLS_BUNDLE_CLASS_NAME_PATTERN
private final ClassLoader classLoader
private NlsMessageFactory messageFactory
private ClasspathScanner classpathScanner
private List<AbstractNlsBundleFactory.NlsBundleInvocationHandler> bundleDescriptors
public AbstractNlsBundleFactory()
public AbstractNlsBundleFactory(ClassLoader classLoader)
classLoader - is the ClassLoader to use.protected void doInitialize()
AbstractComponentinitialization. It is called when AbstractComponent.initialize() is
invoked for the first time. super.AbstractComponent.doInitialize().doInitialize in class AbstractComponentprotected void doInitialized()
AbstractComponentinitialization. It is called when
AbstractComponent.initialize() is invoked for the first time after AbstractComponent.doInitialize() is completed and
initialization-state has changed to initialized. super.AbstractComponent.doInitialized().doInitialized in class AbstractComponentprotected NlsMessageFactory getMessageFactory()
NlsMessageFactory.@Inject public void setMessageFactory(NlsMessageFactory messageFactory)
messageFactory - the NlsMessageFactory to Inject.public ClasspathScanner getClasspathScanner()
@Inject public void setClasspathScanner(ClasspathScanner classpathScanner)
classpathScanner - the ClasspathScanner 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–2016 mmm-Team. All rights reserved.