public class AlwaysAllowed extends Object implements Writer
OutputterChecked
allows the output-name.Constructor and Description |
---|
AlwaysAllowed(ElementOutputter outputter,
Optional<WriterExecuteBeforeEveryOperation> preop) |
Modifier and Type | Method and Description |
---|---|
Optional<Path> |
createFilenameForWriting(String outputName,
String extension)
The path to write a particular output to.
|
Optional<OutputterChecked> |
createSubdirectory(String outputName,
boolean inheritOutputRulesAndRecording)
Maybe creates a subdirectory for writing to.
|
<T> boolean |
write(String outputName,
ElementWriterSupplier<T> elementWriter,
ElementSupplier<T> element)
Writes an element using an
ElementWriter to the current directory. |
<T> boolean |
writeWithIndex(IndexableOutputNameStyle outputNameStyle,
ElementWriterSupplier<T> elementWriter,
ElementSupplier<T> element,
String index)
Writes an indexed-element using an
ElementWriter in the current directory. |
<T> boolean |
writeWithoutName(String outputName,
ElementWriterSupplier<T> elementWriter,
ElementSupplier<T> element)
Writes an element using an
ElementWriter to the current directory, without
including an output name in the path. |
public AlwaysAllowed(ElementOutputter outputter, Optional<WriterExecuteBeforeEveryOperation> preop)
public Optional<OutputterChecked> createSubdirectory(String outputName, boolean inheritOutputRulesAndRecording) throws OutputWriteFailedException
Writer
createSubdirectory
in interface Writer
outputName
- the name of the subdirectory. This may determine if an output is allowed or
not.inheritOutputRulesAndRecording
- if true, the output rules and recording are inherited
from the parent directory. if false, they are not, and all outputs are allowed and are
unrecorded.Optional.empty()
.OutputWriteFailedException
public <T> boolean write(String outputName, ElementWriterSupplier<T> elementWriter, ElementSupplier<T> element) throws OutputWriteFailedException
Writer
ElementWriter
to the current directory.write
in interface Writer
outputName
- the name of the subdirectory. This may determine if an output is allowed or
not.elementWriter
- writes the element to the filesystem.element
- the element to write.OutputWriteFailedException
public <T> boolean writeWithIndex(IndexableOutputNameStyle outputNameStyle, ElementWriterSupplier<T> elementWriter, ElementSupplier<T> element, String index) throws OutputWriteFailedException
Writer
ElementWriter
in the current directory.writeWithIndex
in interface Writer
outputNameStyle
- how to combine a particular output-name with an index.elementWriter
- writes the element to the filesystem.element
- the element to write.index
- the index.OutputWriteFailedException
public <T> boolean writeWithoutName(String outputName, ElementWriterSupplier<T> elementWriter, ElementSupplier<T> element) throws OutputWriteFailedException
Writer
ElementWriter
to the current directory, without
including an output name in the path.writeWithoutName
in interface Writer
outputName
- the name of the subdirectory. This may determine if an output is allowed or
not, but will not be included in the outputted filename.elementWriter
- writes the element to the filesystem.element
- the element to write.OutputWriteFailedException
public Optional<Path> createFilenameForWriting(String outputName, String extension)
Writer
This is an alternative method to write to the file system rather than using an ElementWriter
and Writer.write(String, ElementWriterSupplier, ElementSupplier)
and Writer.writeWithIndex(IndexableOutputNameStyle, ElementWriterSupplier, ElementSupplier, String)
.
createFilenameForWriting
in interface Writer
outputName
- the output-name. This is the filename without an extension, and may
determine if an output is allowed or not.extension
- the extensionOptional.empty()
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.