T
- the target data model typepublic abstract class ModelIoFactory<T> extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MODEL_INPUT_CLASS_FORMAT
Deprecated.
Use
ModelInputLocation to specify ModelInput instead |
static String |
MODEL_OUTPUT_CLASS_FORMAT
Deprecated.
Use
ModelOutputLocation to specify ModelOutput instead |
Constructor and Description |
---|
ModelIoFactory(Class<T> modelClass)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
ModelInput<T> |
createModelInput(InputStream in)
Creates a new
ModelInput for the target InputStream . |
ModelInput<T> |
createModelInput(RecordParser parser)
Creates a new
ModelInput for the target RecordParser . |
T |
createModelObject()
Creates a new data model object.
|
ModelOutput<T> |
createModelOutput(OutputStream out)
Creates a new
ModelOutput for the target OutputStream . |
ModelOutput<T> |
createModelOutput(RecordEmitter emitter)
Creates a new
ModelOutput for the target RecordEmitter . |
protected abstract RecordEmitter |
createRecordEmitter(OutputStream out)
Creates a new default
RecordEmitter . |
protected abstract RecordParser |
createRecordParser(InputStream in)
Creates a new default
RecordParser . |
protected Class<?> |
findModelInputClass()
Returns the
ModelInput class for this factory. |
protected Class<?> |
findModelOutputClass()
Returns the
ModelOutput class for this factory. |
protected Class<T> |
getModelClass()
Returns the target data model class.
|
@Deprecated public static final String MODEL_INPUT_CLASS_FORMAT
ModelInputLocation
to specify ModelInput
insteadModelInput
in MessageFormat.
{0}
- base package name {1}
- simple class name @Deprecated public static final String MODEL_OUTPUT_CLASS_FORMAT
ModelOutputLocation
to specify ModelOutput
insteadModelOutput
in MessageFormat.
{0}
- base package name {1}
- simple class name public ModelIoFactory(Class<T> modelClass)
modelClass
- the data model classIllegalArgumentException
- if the parameter is null
protected Class<T> getModelClass()
public T createModelObject() throws IOException
IOException
- if failed to create a new objectpublic ModelInput<T> createModelInput(InputStream in) throws IOException
ModelInput
for the target InputStream
.in
- an input stream that provides serialized data model objectsIOException
- if failed to initialize the ModelInput
IllegalArgumentException
- if the parameter is null
public ModelInput<T> createModelInput(RecordParser parser) throws IOException
ModelInput
for the target RecordParser
.parser
- a parser that provides records of data model objectsIOException
- if failed to initialize the ModelInput
IllegalArgumentException
- if the parameter is null
public ModelOutput<T> createModelOutput(OutputStream out) throws IOException
ModelOutput
for the target OutputStream
.out
- an output stream that accepts serialized data model objectsIOException
- if failed to initialize the ModelOutput
IllegalArgumentException
- if the parameter is null
public ModelOutput<T> createModelOutput(RecordEmitter emitter) throws IOException
ModelOutput
for the target RecordEmitter
.emitter
- an emitter that accepts data model objectsIOException
- if failed to initialize the ModelOutput
IllegalArgumentException
- if the parameter is null
protected abstract RecordParser createRecordParser(InputStream in) throws IOException
RecordParser
.in
- the source inputIOException
- if failed to initialize the parserIllegalArgumentException
- if the parameter is null
protected abstract RecordEmitter createRecordEmitter(OutputStream out) throws IOException
RecordEmitter
.out
- the target outputIOException
- if failed to initialize the emitterIllegalArgumentException
- if the parameter null
protected Class<?> findModelInputClass() throws ClassNotFoundException
ModelInput
class for this factory.ModelInput
classClassNotFoundException
- if the target class is not foundModelInputLocation
protected Class<?> findModelOutputClass() throws ClassNotFoundException
ModelOutput
class for this factory.ModelOutput
classClassNotFoundException
- if the target class is not foundModelInputLocation
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.