Class IOFactory
java.lang.Object
de.uni_trier.wi2.procake.utils.io.IOFactory
- All Implemented Interfaces:
Factory
This factory contains all registered
ProCAKEReader
a and ProCAKEWriter
s
of ProCAKE.
To way how to get a io component is always the same:
- request the io names that are able to handle a given class
- request the io component with one of the names
For example, to get an parser for a Model
the Java code would be:
String names[] = IOFactory.getReaderNamesFor(Model.class); if (names.length == 0) throw new CakeIOException(IO.COMPONENT, IO.LOG_READER_NOT_FOUND, this, Model.class); ProCAKEReader reader = (ProCAKEReader) IOFactory.newIO(names[0]); reader.setFilename("..."); Model model = (Model) reader.read();
It is guaranteed that you can cast the result of an reader or content handler to the class for that you have requested the reader.
- Author:
- Rainer Maximini, Maximilian Hoffmann
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(AbstractParameter param) Adds a parameter to this factory.static boolean
boolean
Bind an implementation to the factory.getContentHandlerNamesFor
(Class value) Returns a list of names of the content handlers that are capable to read the given class.getContentHandlerNamesFor
(Object value) Returns a list of names of the content handlers that are capable to read the given object.getFamiliarContentHandler
(String familyName) Returns a list of names of content handlers, which are capable of handling files for the given familyName.getFamiliarWriter
(String familyName) Returns a list of names ofProCAKEWriter
s, which are of the same family as the given familyName.getFamiliarWriter
(String familyName, Class forClass) Returns a list of names ofProCAKEWriter
s, which are of the same family as the given familyName AND are capable of writing the given object-class.static String
getParameter
(String key) getReaderNamesFor
(Class value) Returns a list of names of theProCAKEReader
s that are capable to read the given class.getReaderNamesFor
(Object value) Returns a list of names of theProCAKEReader
s that are capable to read the given object.getWriterNamesFor
(Class value) Returns a list of names of theProCAKEWriter
s that are capable to read the given class.getWriterNamesFor
(Object value) Returns a list of names of theProCAKEWriter
s that are capable to read the given object.static IO
Creates a new instance of the io component with the given name.void
reset()
This method has to be implemented by every factory in order to allow a proper restart of ProCAKE.static boolean
boolean
Unbinds an implementation from the factory.
-
Method Details
-
bind
-
getContentHandlerNamesFor
Returns a list of names of the content handlers that are capable to read the given class.- Parameters:
value
- The content handler must be capable to read this class.- Returns:
- Returns a list of names of the content handlers that are capable to read the given class.
-
getContentHandlerNamesFor
Returns a list of names of the content handlers that are capable to read the given object.- Parameters:
value
- The content handler must be capable to read this object.- Returns:
- Returns a list of names of the content handlers that are capable to read the given object.
-
getIONames
- Returns:
- Returns a list of names of all io components that are registered.
-
getReaderNamesFor
Returns a list of names of theProCAKEReader
s that are capable to read the given class.- Parameters:
value
- TheProCAKEReader
must be capable to read this class.- Returns:
- Returns a list of names of the
ProCAKEReader
s that are capable to read the given class.
-
getReaderNamesFor
Returns a list of names of theProCAKEReader
s that are capable to read the given object.- Parameters:
value
- TheProCAKEReader
must be capable to read this object.- Returns:
- Returns a list of names of the
ProCAKEReader
s that are capable to read the given object.
-
getWriterNamesFor
Returns a list of names of theProCAKEWriter
s that are capable to read the given class.- Parameters:
value
- TheProCAKEWriter
must be capable to read this class.- Returns:
- Returns a list of names of the
ProCAKEWriter
s that are capable to read the given class.
-
getWriterNamesFor
Returns a list of names of theProCAKEWriter
s that are capable to read the given object.- Parameters:
value
- TheProCAKEWriter
must be capable to read this object.- Returns:
- Returns a list of names of the
ProCAKEWriter
s that are capable to read the given object.
-
getFamiliarWriter
Returns a list of names ofProCAKEWriter
s, which are of the same family as the given familyName.- Parameters:
familyName
-- Returns:
-
getFamiliarWriter
Returns a list of names ofProCAKEWriter
s, which are of the same family as the given familyName AND are capable of writing the given object-class.- Returns:
-
getFamiliarContentHandler
Returns a list of names of content handlers, which are capable of handling files for the given familyName.- Parameters:
familyName
-- Returns:
-
newIO
Creates a new instance of the io component with the given name.- Parameters:
name
- The name of the IO object.- Returns:
- A new IO object.
-
unbind
-
getParameter
-
reset
public void reset()Description copied from interface:Factory
This method has to be implemented by every factory in order to allow a proper restart of ProCAKE. For example, this method might reset the default factory object or other stateful variables. -
addParameter
Description copied from interface:Factory
Adds a parameter to this factory.- Specified by:
addParameter
in interfaceFactory
- Parameters:
param
- the parameter to add
-
bind
Description copied from interface:Factory
Bind an implementation to the factory. -
unbind
Description copied from interface:Factory
Unbinds an implementation from the factory.
-