Class StreamFactoryRegistry

Namespace
NOpenNLP.Tools.Formats
Assembly
NOpenNLP.Tools.dll

Registry for object stream factories.

public static class StreamFactoryRegistry
Inheritance
StreamFactoryRegistry
Inherited Members

Fields

DefaultFormat

The format assumed when the user names none.

public const string DefaultFormat = "opennlp"

Field Value

string

Methods

GetFactories<T>()

Returns all factories which produce objects of type T, keyed by format name, in registration order.

public static IReadOnlyDictionary<string, IObjectStreamFactory<T>> GetFactories<T>()

Returns

IReadOnlyDictionary<string, IObjectStreamFactory<T>>

Type Parameters

T

GetFactory<T>(string?)

Returns the factory which reads the format named formatName and produces objects of type T, or null when no such format is registered.

public static IObjectStreamFactory<T>? GetFactory<T>(string? formatName)

Parameters

formatName string

the format name; when null, DefaultFormat is assumed

Returns

IObjectStreamFactory<T>

Type Parameters

T

RegisterFactory<T>(string, IObjectStreamFactory<T>)

Registers factory, which reads the format named formatName and instantiates streams producing objects of type T.

public static bool RegisterFactory<T>(string formatName, IObjectStreamFactory<T> factory)

Parameters

formatName string
factory IObjectStreamFactory<T>

Returns

bool

true if the factory was successfully registered

Type Parameters

T

UnregisterFactory<T>(string)

Unregisters the factory which reads the format named formatName and produces objects of type T.

public static void UnregisterFactory<T>(string formatName)

Parameters

formatName string

Type Parameters

T