public class I18NFactory extends ManagedFactory
LanguageCodes
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 LanguageCodes
, IANACharsets
, and
CountryCodes
.
LanguageCodes
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_CHARSETS
Identifier for shared
IANACharsets instance. |
static java.lang.String |
ID_COUNTRIES
Identifier for shared
CountryCodes instance. |
static java.lang.String |
ID_LANGUAGES
Identifier for shared
LanguageCodes instance. |
protected static I18NFactory |
sharedInstance
Shared
I18NFactory instance. |
cacheObjectByID
Constructor and Description |
---|
I18NFactory()
Constructs an instance of this factory.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRelease(java.lang.String id)
Checks whether a factory shared object can be released or not.
|
void |
cleanup(java.lang.String id)
Perform optional cleanup tasks like closing database connections or disposing dialogs.
|
static I18NFactory |
getSharedInstance()
Provides the shared instance of the factory implementation.
|
java.lang.Object |
request(java.lang.String id)
Create the factory shared object, recycle if already existing.
|
getRegisteredObjects, hasSharedInstance, release, releaseByStrategy, releaseForced, set
protected static I18NFactory sharedInstance
I18NFactory
instance.public static final java.lang.String ID_LANGUAGES
LanguageCodes
instance.public static final java.lang.String ID_CHARSETS
IANACharsets
instance.public static final java.lang.String ID_COUNTRIES
CountryCodes
instance.public I18NFactory()
public static I18NFactory getSharedInstance()
public java.lang.Object request(java.lang.String id)
request
in class ManagedFactory
id
- The factory-unique identifier of the shared objectnull
if none could be createdpublic boolean canRelease(java.lang.String id)
canRelease
in class ManagedFactory
id
- The factory-unique identifier of the shared objectpublic void cleanup(java.lang.String id)
cleanup
in class ManagedFactory
id
- The factory-unique identifier of the shared objectCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.