com.levigo.jadice.document.read.fluent
Interface ReadConfigurer

All Known Subinterfaces:
AsyncReadConfigurer, SyncReadConfigurer

public interface ReadConfigurer

The ReadConfigurer is the main point of interaction with the fluent read API and the reading process. The ReadConfigurer provides APIs to:

IMPORTANT: This interface is used as a public part of the fluent read API. It is not designed to be implemented and must not be implemented by clients.


Method Summary
 ReadConfigurer add(ReadConfiguration... readConfigurations)
          Add existing ReadConfigurations.
<T extends ReaderSettings>
T
defaultControls(Class<T> settingsClass)
          Access ReaderSettings which will be used by subsequent task creations.
 LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(DocumentLayer from)
          Generate a default layer mapping which will be used by subsequent task creations.
 LayerMappingBuilder<ReadConfigurer> defaultLayerMapping(String from)
          Generate a default layer mapping which will be used by subsequent task creations.
 Document getFirstDocument()
          Returns the first registered document.
 List<Document> getRegisteredDocuments()
          Returns all with this ReadConfigurer registered Documents.
 DocumentBuilder into(Document doc)
          Configure a Document as the target for reading.
 DocumentBuilder newDocument()
          Create a new Document.
 DocumentBuilder newDocument(String documentName)
          Create a new Document and set a name.
 TaskBuilder skip(int pageCountToBeSkipped)
          Start a task which skips the given number of pages.
 TaskBuilder task(InputStream source)
          Start a task which uses the given source to load pages from.
 TaskBuilder task(Provider<? extends InputStream,IOException> sourceProvider)
          Start a task which uses the given source to load pages from.
 

Method Detail

add

ReadConfigurer add(ReadConfiguration... readConfigurations)
Add existing ReadConfigurations. These ReadConfigurations provide a modularized way to generate Documents.

Parameters:
readConfigurations - the ReadConfigurations to include
Returns:
returns a ReadConfigurer instance to allow fluent API use. For details please see Read
See Also:
Read

defaultControls

<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

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

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

getFirstDocument

Document getFirstDocument()
Returns the first registered document. A Document will be registered once a DocumentBuilder is created, for example using the methods into(Document), newDocument() or newDocument(String).

This method is a shortcut for the following code:
Document doc = null;
List<Document> registered = getRegisteredDocuments();
if (registered.size() > 0) {
  doc = registered.get(0);
}

Returns:
either the first registered Document or null if no Document has been registered before.

getRegisteredDocuments

List<Document> getRegisteredDocuments()
Returns all with this ReadConfigurer registered Documents. A Document will be registered once a DocumentBuilder is created, for example using the methods into(Document), newDocument() or newDocument(String).

Returns:
a List of all registered documents. This method will never return null, instead it returns a empty list.

into

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

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

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

task

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

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

skip

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


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