Package com.amihaiemil.eoyaml
Interface YamlScalarBuilder
-
public interface YamlScalarBuilderBuilder of Yaml Scalar. Implementations should be immutable and thread-safe.- Since:
- 4.0.0
- Version:
- $Id: 73dd7df4b103db6449585cafac130c32c6237603 $
- Author:
- Mihai Andronache (amihaiemil@gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description YamlScalarBuilderaddLine(String value)Add a line of text this Scalar.default ScalarbuildFoldedBlockScalar()Build a Folded Block Scalar.ScalarbuildFoldedBlockScalar(String comment)Build a Folded Block Scalar.default ScalarbuildLiteralBlockScalar()Build a Literal Block Scalar.ScalarbuildLiteralBlockScalar(String comment)Build a Literal Block Scalar.default ScalarbuildPlainScalar()Build a plain Scalar.default ScalarbuildPlainScalar(String inline)Build a plain Scalar.ScalarbuildPlainScalar(String above, String inline)Build a plain Scalar.
-
-
-
Method Detail
-
addLine
YamlScalarBuilder addLine(String value)
Add a line of text this Scalar. You can use this multiple times or just once, if your String already contains NEW_LINE chars.- Parameters:
value- String- Returns:
- An instance of this builder.
-
buildPlainScalar
default Scalar buildPlainScalar()
Build a plain Scalar. Ideally, you should use this when your scalar is short, a single line of text.
If you added more lines of text, all of them will be put together, separated by spaces.- Returns:
- The built Scalar.
-
buildFoldedBlockScalar
default Scalar buildFoldedBlockScalar()
Build a Folded Block Scalar. Use this when your scalar has multiple lines of text, but you don't care about the newlines, you want them all separated by spaces.
The difference from buildPlainScalar() comes when you are printing the created YAML:plain: a very long scalar which should have been built as Folded folded:> a very long scalar which has been folded for readability- Returns:
- The built Scalar.
-
buildLiteralBlockScalar
default Scalar buildLiteralBlockScalar()
Build a Literal Block Scalar. Use this when your scalar has multiple lines and you want these lines to be separated.- Returns:
- The built Scalar.
-
buildPlainScalar
default Scalar buildPlainScalar(String inline)
Build a plain Scalar. Ideally, you should use this when your scalar is short, a single line of text.
If you added more lines of text, all of them will be put together, separated by spaces.- Parameters:
inline- Inline comment referring to the built scalar. If it has more lines, they will be concatenated into a single line.- Returns:
- The built Scalar.
-
buildPlainScalar
Scalar buildPlainScalar(String above, String inline)
Build a plain Scalar. Ideally, you should use this when your scalar is short, a single line of text.
If you added more lines of text, all of them will be put together, separated by spaces.- Parameters:
above- Comment above the scalar. It may have multiple lines.inline- Inline comment referring to the built scalar. If it has more lines, they will be concatenated into a single line.- Returns:
- The built Scalar.
-
buildFoldedBlockScalar
Scalar buildFoldedBlockScalar(String comment)
Build a Folded Block Scalar. Use this when your scalar has multiple lines of text, but you don't care about the newlines, you want them all separated by spaces.
The difference from buildPlainScalar() comes when you are printing the created YAML:plain: a very long scalar which should have been built as Folded folded:> a very long scalar which has been folded for readability- Parameters:
comment- Comment referring to the built scalar.- Returns:
- The built Scalar.
-
-