public class MessageFactory
extends java.lang.Object
MessageCodes
objects while running your application and it is
acceptable for you to continously use a certain amount of memory for the cached object. If you
only use instances once then you should either install an object as usual (by calling
new
), or let this factory create a shared instance and flush the factory after
you're finished with the object. The garbage collector will then release memory on-the-fly as the
objects are no longer referenced so the overall memory footprint can be very small. You should
keep the shared instances created by this class if you make heavy use of the supported classes
(currently MessageCodes
).
MessageCodes
Modifier and Type | Field and Description |
---|---|
protected static java.util.Hashtable<java.lang.String,MessageCodes> |
mcodesByID
Container with shared codes (key:
String , value: MessageCodes ). |
Constructor and Description |
---|
MessageFactory()
Constructor method for i18n purposes only.
|
Modifier and Type | Method and Description |
---|---|
static MessageCodes |
createMessageCodes(java.lang.String id,
java.lang.String base,
java.lang.Object loader)
Creates a shared
MessageCodes instance. |
static void |
flushMessageCodes(java.lang.String id)
Removes the shared
MessageCodes instance if installed. |
static boolean |
hasMessageCodes(java.lang.String id)
Determines whether a shared
MessageCodes instance has already been created. |
protected static final java.util.Hashtable<java.lang.String,MessageCodes> mcodesByID
String
, value: MessageCodes
).public MessageFactory() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic static MessageCodes createMessageCodes(java.lang.String id, java.lang.String base, java.lang.Object loader)
MessageCodes
instance.
id
- The desired domain identifier like "LIMA"base
- The classpath with language specific sub-directories with page filesloader
- The instance to use as class loader for the resourcesMessageCodes
instancepublic static void flushMessageCodes(java.lang.String id)
MessageCodes
instance if installed.
id
- The desired domain identifier like "LIMA", null
clears whole cachepublic static boolean hasMessageCodes(java.lang.String id)
MessageCodes
instance has already been created.
id
- The desired domain identifier like "LIMA"Copyright © 2005-2023 Leisenfels GmbH. All rights reserved.