Package space.arim.dazzleconf.factory
Class BaseConfigurationFactory<C>
java.lang.Object
space.arim.dazzleconf.factory.BaseConfigurationFactory<C>
- Type Parameters:
C
- the type of the configuration
- All Implemented Interfaces:
ConfigurationFactory<C>
@Deprecated
public abstract class BaseConfigurationFactory<C>
extends Object
implements ConfigurationFactory<C>
Deprecated.
Will be removed without replacement in a later release. Contributes
little value on its own.
Basic abstract implementation of of
ConfigurationFactory
. Eliminates some basic boilerplate
associated with IO operations.- Author:
- A248
-
Constructor Summary
ModifierConstructorDescriptionprotected
BaseConfigurationFactory(Class<C> configClass, ConfigurationOptions options)
Deprecated.Creates from a config class and config options -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Charset
charset()
Deprecated.The charset used by this factoryDeprecated.Gets the configuration class this factory is forDeprecated.Gets the configuration options this factory usesload(InputStream inputStream)
Deprecated.Reads configuration data from an input streamload(InputStream inputStream, C auxiliaryEntries)
Deprecated.Reads configuration data from an input stream with the given auxiliary configuration instance.load(ReadableByteChannel readChannel)
Deprecated.Reads configuration data from a readable channelload(ReadableByteChannel readChannel, C auxiliaryEntries)
Deprecated.Reads configuration data from a readable channel with the given auxiliary configuration instance.protected abstract C
loadFromReader(Reader reader)
Deprecated.Reads config data from the specified readerprotected abstract C
loadFromReader(Reader reader, C auxiliaryEntries)
Deprecated.Reads config data from the specified reader with the given auxiliary entries.void
write(C configData, OutputStream outputStream)
Deprecated.Writes configuration data to an output streamvoid
write(C configData, WritableByteChannel writableChannel)
Deprecated.Writes configuration data to a writable byte channelprotected abstract void
writeToWriter(C configData, Writer writer)
Deprecated.Writes config data to the specified writerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface space.arim.dazzleconf.ConfigurationFactory
loadDefaults
-
Constructor Details
-
BaseConfigurationFactory
Deprecated.Creates from a config class and config options- Parameters:
configClass
- the config classoptions
- configuration options- Throws:
NullPointerException
- ifconfigClass
oroptions
is nullIllegalArgumentException
- ifconfigClass
is not an interface
-
-
Method Details
-
getConfigClass
Deprecated.Description copied from interface:ConfigurationFactory
Gets the configuration class this factory is for- Specified by:
getConfigClass
in interfaceConfigurationFactory<C>
- Returns:
- the configuration class
-
getOptions
Deprecated.Description copied from interface:ConfigurationFactory
Gets the configuration options this factory uses- Specified by:
getOptions
in interfaceConfigurationFactory<C>
- Returns:
- the configuration options
-
charset
Deprecated.The charset used by this factory- Returns:
- the charset to use
-
loadFromReader
Deprecated.Reads config data from the specified reader- Parameters:
reader
- the stream reader- Returns:
- the config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is not valid
-
loadFromReader
protected abstract C loadFromReader(Reader reader, C auxiliaryEntries) throws IOException, InvalidConfigExceptionDeprecated.Reads config data from the specified reader with the given auxiliary entries. The auxiliary entries are the same ones passed toConfigurationFactory
- Parameters:
reader
- the stream readerauxiliaryEntries
- the auxiliary entries- Returns:
- the config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is not valid
-
load
Deprecated.Description copied from interface:ConfigurationFactory
Reads configuration data from a readable channel- Specified by:
load
in interfaceConfigurationFactory<C>
- Parameters:
readChannel
- the channel from which to read the data- Returns:
- the read config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is invalid. Where possible, more specific subclasses are thrown
-
load
Deprecated.Description copied from interface:ConfigurationFactory
Reads configuration data from an input stream- Specified by:
load
in interfaceConfigurationFactory<C>
- Parameters:
inputStream
- the stream from which to read the data- Returns:
- the read config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is invalid. Where possible, more specific subclasses are thrown
-
load
public C load(ReadableByteChannel readChannel, C auxiliaryEntries) throws IOException, InvalidConfigExceptionDeprecated.Description copied from interface:ConfigurationFactory
Reads configuration data from a readable channel with the given auxiliary configuration instance. Any keys missing in the loaded config data will be supplanted by the config instance's corresponding entry.
By checking if the returned configuration implementsAuxiliaryKeys
, the caller can determine whether any of the auxiliary entries were used.- Specified by:
load
in interfaceConfigurationFactory<C>
- Parameters:
readChannel
- the channel from which to read the dataauxiliaryEntries
- the auxiliary configuration instance- Returns:
- the read config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is invalid. Where possible, more specific subclasses are thrown
-
load
public C load(InputStream inputStream, C auxiliaryEntries) throws IOException, InvalidConfigExceptionDeprecated.Description copied from interface:ConfigurationFactory
Reads configuration data from an input stream with the given auxiliary configuration instance. Any keys missing in the loaded config data will be supplanted by the config instance's corresponding entry.
By checking if the returned configuration implementsAuxiliaryKeys
, the caller can determine whether any of the auxiliary entries were used.- Specified by:
load
in interfaceConfigurationFactory<C>
- Parameters:
inputStream
- the stream from which to read the dataauxiliaryEntries
- the auxiliary configuration instance- Returns:
- the read config data
- Throws:
IOException
- if an I/O error occursInvalidConfigException
- if the configuration is invalid. Where possible, more specific subclasses are thrown
-
writeToWriter
Deprecated.Writes config data to the specified writer- Parameters:
configData
- the configuration data to writewriter
- the stream writer- Throws:
IOException
- if an I/O error occurs
-
write
Deprecated.Description copied from interface:ConfigurationFactory
Writes configuration data to a writable byte channel- Specified by:
write
in interfaceConfigurationFactory<C>
- Parameters:
configData
- the configuration datawritableChannel
- the channel to which to write the data- Throws:
IOException
- if an I/O error occurs
-
write
Deprecated.Description copied from interface:ConfigurationFactory
Writes configuration data to an output stream- Specified by:
write
in interfaceConfigurationFactory<C>
- Parameters:
configData
- the configuration dataoutputStream
- the stream to which to write the data- Throws:
IOException
- if an I/O error occurs
-