opennlp.tools.cmdline
Class StreamFactoryRegistry

java.lang.Object
  extended by opennlp.tools.cmdline.StreamFactoryRegistry

public final class StreamFactoryRegistry
extends Object

Registry for object stream factories.


Field Summary
static String DEFAULT_FORMAT
           
 
Method Summary
static
<T> Map<String,ObjectStreamFactory<T>>
getFactories(Class<T> sampleClass)
          Returns all factories which produce objects of sampleClass class.
static
<T> ObjectStreamFactory<T>
getFactory(Class<T> sampleClass, String formatName)
          Returns a factory which reads format named formatName and instantiates streams producing objects of sampleClass class.
static boolean registerFactory(Class sampleClass, String formatName, ObjectStreamFactory factory)
          Registers factory which reads format named formatName and instantiates streams producing objects of sampleClass class.
static void unregisterFactory(Class sampleClass, String formatName)
          Unregisters a factory which reads format named formatName and instantiates streams producing objects of sampleClass class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

public static final String DEFAULT_FORMAT
See Also:
Constant Field Values
Method Detail

registerFactory

public static boolean registerFactory(Class sampleClass,
                                      String formatName,
                                      ObjectStreamFactory factory)
Registers factory which reads format named formatName and instantiates streams producing objects of sampleClass class.

Parameters:
sampleClass - class of the objects, produced by the streams instantiated by the factory
formatName - name of the format
factory - instance of the factory
Returns:
true if the factory was successfully registered

unregisterFactory

public static void unregisterFactory(Class sampleClass,
                                     String formatName)
Unregisters a factory which reads format named formatName and instantiates streams producing objects of sampleClass class.

Parameters:
sampleClass - class of the objects, produced by the streams instantiated by the factory
formatName - name of the format

getFactories

public static <T> Map<String,ObjectStreamFactory<T>> getFactories(Class<T> sampleClass)
Returns all factories which produce objects of sampleClass class.

Parameters:
sampleClass - class of the objects, produced by the streams instantiated by the factory
Returns:
formats mapped to factories

getFactory

public static <T> ObjectStreamFactory<T> getFactory(Class<T> sampleClass,
                                                    String formatName)
Returns a factory which reads format named formatName and instantiates streams producing objects of sampleClass class.

Parameters:
sampleClass - class of the objects, produced by the streams instantiated by the factory
formatName - name of the format, if null, assumes OpenNLP format
Returns:
factory instance


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.