- All Known Implementing Classes:
MapTreeWriter
public interface TreeWriter
Interface for writing the configuration and state of a Component, or tree of
components, into a data structure.
A Component should write its type, component info and properties to the writer, in that order. A Container should additionally write its children and connections. Arbitrary annotations may be added.
The format and completeness of the output data is not specified.
-
Method Summary
Modifier and TypeMethodDescriptionwriteAnnotation(String key, String value) Write a custom annotation.writeChild(String id, Consumer<TreeWriter> processor) Write the data for a child component.writeConnection(Connection connection) Write a port connection between two child component.writeInfo(ComponentInfo info) Write the component info.writeProperty(String id, Value value) Write the value of a property.writeType(ComponentType type) Write the component type.
-
Method Details
-
writeType
Write the component type.- Parameters:
type- component type- Returns:
- this writer
-
writeInfo
Write the component info.- Parameters:
info- component info- Returns:
- this writer
-
writeAnnotation
Write a custom annotation.- Parameters:
key- annotation idvalue- annotation value- Returns:
- this writer
-
writeProperty
Write the value of a property.A component may write properties that are at their defaults if this is more efficient. Consumers of the resulting data may verify against the provided info.
- Parameters:
id-value-- Returns:
- this writer
-
writeChild
Write the data for a child component.The processor will be called during the execution of this method. The passed in writer may be the same writer, configured to refer to the child, or a new writer instance. The writer should not be cached or used outside of the processor.
- Parameters:
id- child IDprocessor- writer consumer to process and write child- Returns:
- this writer
-
writeConnection
Write a port connection between two child component.- Parameters:
connection- port connection- Returns:
- this writer
-