public class MimeTypeFactory extends ManagedFactory
MimeType
).
Whenever possible, this factory will hand out references to shared instances. Use this if you
need many, many MIME types 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.
Modifier and Type | Field and Description |
---|---|
protected static MimeTypeFactory |
sharedInstance
Shared
MimeTypeFactory instance. |
cacheObjectByID
Constructor and Description |
---|
MimeTypeFactory()
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 javax.activation.MimeType |
getMimeType(java.lang.String rawdata)
Convenience method to get a certain MIME type from the shared instance of this factory.
|
static MimeTypeFactory |
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 MimeTypeFactory sharedInstance
MimeTypeFactory
instance.public MimeTypeFactory()
public static MimeTypeFactory 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 objectpublic static javax.activation.MimeType getMimeType(java.lang.String rawdata)
rawdata
- The factory-unique identifier of the shared objectnull
if none could be createdCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.