Class PluginOutput
- Author:
- Bastian Wolf
-
Constructor Summary
ConstructorDescriptionConstructs an empty `PluginOutput` object.PluginOutput
(ArrayList<OutputField> fields) Constructs a `PluginOutput` object with a predefined list of `OutputField` objects. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new `OutputField` to the list of fields with the specified description and value.void
addField
(OutputField field) Adds a new `OutputField` to the list of fields.Retrieves the merged output string.void
Merges all fields into a single output string.
-
Constructor Details
-
PluginOutput
public PluginOutput()Constructs an empty `PluginOutput` object.This constructor initializes the `fields` list to an empty `ArrayList` and sets the `output` string to an empty string. It is useful when starting with an empty output that will be populated later.
-
PluginOutput
Constructs a `PluginOutput` object with a predefined list of `OutputField` objects.This constructor initializes the `PluginOutput` with a provided list of `OutputField` objects. The `output` string is not immediately merged; it can be generated later using the `mergeFields` method.
- Parameters:
fields
- an `ArrayList` of `OutputField` objects to initialize the `PluginOutput`.
-
-
Method Details
-
addField
Adds a new `OutputField` to the list of fields.This method appends a new `OutputField` object to the `fields` list. It allows dynamically adding fields to the `PluginOutput` after it has been created.
- Parameters:
field
- the `OutputField` object to be added.
-
addField
Adds a new `OutputField` to the list of fields with the specified description and value.This method creates a new `OutputField` object with the given description and value, and then appends it to the `fields` list. It provides a convenient way to add fields without explicitly creating `OutputField` objects.
- Parameters:
description
- a `String` representing the description of the output field.value
- a `String` representing the value of the output field.
-
mergeFields
public void mergeFields()Merges all fields into a single output string.This method concatenates the merged output of each `OutputField` in the `fields` list into a single `output` string, separated by new lines. This merged string can then be retrieved using the `getOutput` method.
-
getOutput
Retrieves the merged output string.This method first calls `mergeFields` to ensure the output string is up-to-date, then returns the merged output string that contains the content of all fields.
- Returns:
- a `String` containing the merged output from all fields.
-