com.levigo.jadice.document.read.fluent
Class ReadConfiguration

java.lang.Object
  extended by com.levigo.jadice.document.read.fluent.ReadConfiguration
Direct Known Subclasses:
FileOpener.FileOpenerReadConfiguration

public abstract class ReadConfiguration
extends Object

A base class for reusable read configurations.


Constructor Summary
ReadConfiguration()
           
 
Method Summary
protected  void add(ReadConfiguration... readConfigurations)
          Add additional ReadConfigurations.
 void configure(ReadConfigurer rc)
          Configure the ReadConfiguration for the given ReadConfigurer.
protected
<T extends ReaderSettings>
T
defaultControls(Class<T> settingsClass)
          Access ReaderSettings which will be used by subsequent task creations.
protected  LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(DocumentLayer from)
          Generate a default layer mapping which will be used by subsequent task creations.
protected  LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(String from)
          Generate a default layer mapping which will be used by subsequent task creations.
protected abstract  void doConfigure()
          doConfigure() implementations may configure the reading process using the methods defined in this base class (except configure(ReadConfigurer) and doConfigure()).
protected  DocumentBuilder into(Document doc)
          Configure a Document as the target for reading.
protected  DocumentBuilder newDocument()
          Create a new Document.
protected  DocumentBuilder newDocument(String documentName)
          Create a new Document and set a name.
protected  TaskBuilder skip(int pageCountToBeSkipped)
          Start a task which skips the given number of pages.
protected  TaskBuilder task(InputStream source)
          Start a task which uses the given source to load pages from.
protected  TaskBuilder task(Provider<? extends InputStream,IOException> sourceProvider)
          Start a task which uses the given source to load pages from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadConfiguration

public ReadConfiguration()
Method Detail

configure

public final void configure(ReadConfigurer rc)
Configure the ReadConfiguration for the given ReadConfigurer. This method is synchronized by intention, as during the configuration a ReadConfiguration is stateful. Once configure(ReadConfigurer) is left, the ReadConfiguration is stateless again.

Parameters:
rc - the ReadConfigurer which shall be configured.

doConfigure

protected abstract void doConfigure()
doConfigure() implementations may configure the reading process using the methods defined in this base class (except configure(ReadConfigurer) and doConfigure()).


into

protected final DocumentBuilder into(Document doc)
Configure a Document as the target for reading. Unlike the newDocument() and newDocument(String) methods, this method uses an existing Document and adds all loaded Pages to the end.

Parameters:
doc - the Document to append Pages to.
Returns:
returns a DocumentBuilder instance to allow fluent API use. For details please see Read

newDocument

protected final DocumentBuilder newDocument()
Create a new Document. The returned DocumentBuilder will be liked to that newly created Document and all instructions on DocumentBuilder will affect the generated Document.

Returns:
returns a DocumentBuilder instance to allow fluent API use. For details please see Read

newDocument

protected final DocumentBuilder newDocument(String documentName)
Create a new Document and set a name. The returned DocumentBuilder will be liked to that newly created Document and all instructions on DocumentBuilder will affect the generated Document.

Parameters:
documentName - the name of the new Document
Returns:
returns a DocumentBuilder instance to allow fluent API use. For details please see Read

skip

protected TaskBuilder skip(int pageCountToBeSkipped)
Start a task which skips the given number of pages. For details about the behavior of skip(int) please see TaskBuilder.skip(int).

The resulting task will inherit all previously via defaultControls(Class) and defaultLayerMapping(DocumentLayer) configured defaults.

Parameters:
pageCountToBeSkipped - the number of pages to be skipped.
Returns:
returns a TaskBuilder instance to allow fluent API use. For details please see Read

task

protected TaskBuilder task(InputStream source)
Start a task which uses the given source to load pages from. A task can be configured further using the methods of TaskBuilder.

The resulting task will inherit all previously via defaultControls(Class) and defaultLayerMapping(DocumentLayer) configured defaults.

Parameters:
source - the source to load pages from.
Returns:
returns a TaskBuilder instance to allow fluent API use. For details please see Read

task

protected TaskBuilder task(Provider<? extends InputStream,IOException> sourceProvider)
Start a task which uses the given source to load pages from. A task can be configured further using the methods of TaskBuilder.

The resulting task will inherit all previously via defaultControls(Class) and defaultLayerMapping(DocumentLayer) configured defaults.

Parameters:
sourceProvider - provides an InputStream to load pages from.
Returns:
returns a TaskBuilder instance to allow fluent API use. For details please see Read

add

protected void add(ReadConfiguration... readConfigurations)
Add additional ReadConfigurations.

Parameters:
readConfigurations - the ReadConfigurations to include

defaultControls

protected <T extends ReaderSettings> T defaultControls(Class<T> settingsClass)
Access ReaderSettings which will be used by subsequent task creations. This method works like ProcessingControls.getSettings(Class).

Type Parameters:
T - the target RenderSettings type to be configured.
Parameters:
settingsClass - the target RenderSettings class to configure
Returns:
a RenderSettings implementation

defaultLayerMapping

protected LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(DocumentLayer from)
Generate a default layer mapping which will be used by subsequent task creations.

Parameters:
from - the source layer to build the mapping from
Returns:
a LayerMappingBuilder instance

defaultLayerMapping

protected LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(String from)
Generate a default layer mapping which will be used by subsequent task creations.

Parameters:
from - the source layer to build the mapping from
Returns:
a LayerMappingBuilder instance
Throws:
IllegalArgumentException - if from is null


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.