|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.tools.diagnostics.FactoryRegistry
public class FactoryRegistry
Experimental addition to the API.
This class provides a central registry for image factories
Image factories can be registered directly using the #addFactory()
method.
The default registry obtained by calling getDefaultRegistry()
uses ServiceRegistry
to discover
ImageFactory implementations.
To register an ImageFactory implementation that can be discovered by the registry do the following :
Constructor Summary | |
---|---|
FactoryRegistry()
Creates an empty registry. |
Method Summary | |
---|---|
boolean |
addFactory(ImageFactory factory)
Adds an ImageFactory to the registry instance If the factory instance is already in the registry it is not added again. |
static FactoryRegistry |
getDefaultRegistry()
Returns the default registry. |
ImageFactory[] |
getFactories()
Always returns an array even if the registry is empty |
Image |
getImage(java.io.File file)
Returns an appropriate Image for the
provide file by locating the first registered image factory that can handle
the case insensitive file name extension of the provided file. |
JavaRuntime |
getJavaRuntime(java.io.File file)
Returns an appropriate Image for the
provide file by locating the first registered image factory that can handle
the case insensitive file name extension of the provided file. |
java.util.Iterator<ImageFactory> |
iterator()
Returns an Iterator of ImageFactories registered
to this registry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FactoryRegistry()
Creates an empty registry. To obtain an populated registry use the getDefaultRegistry()
method
Method Detail |
---|
public static FactoryRegistry getDefaultRegistry()
Returns the default registry. This registy is preloaded with
ImageFactory implementations discovered using the ServiceRegistry
public java.util.Iterator<ImageFactory> iterator()
Returns an Iterator
of ImageFactories registered
to this registry.
iterator
in interface java.lang.Iterable<ImageFactory>
public boolean addFactory(ImageFactory factory)
Adds an ImageFactory to the registry instance If the factory instance is already in the registry it is not added again.
factory
- factory to add to registry
IllegalArgument
- if factory is nullpublic ImageFactory[] getFactories()
Always returns an array even if the registry is empty
public Image getImage(java.io.File file) throws java.io.IOException
Returns an appropriate Image
for the
provide file by locating the first registered image factory that can handle
the case insensitive file name extension of the provided file.
If no factory can be found to handle the file then null is returned.
File names without extension will always return null
file
- to create image from
java.lang.IllegalArgumentException
- if file is null
java.io.IOException
- if errors occur during image creationpublic JavaRuntime getJavaRuntime(java.io.File file) throws java.io.IOException
Returns an appropriate Image
for the
provide file by locating the first registered image factory that can handle
the case insensitive file name extension of the provided file.
If no factory can be found to handle the file then null is returned.
File names without extension will always return null
file
- to create image from
java.lang.IllegalArgumentException
- if file is null
java.io.IOException
- if errors occur during image creation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |