Skip to content

Commit 1a27649

Browse files
author
Chong Han
committed
add helper method for parsing multiline String to DslParams
1 parent c1c1501 commit 1a27649

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/main/java/com/lmax/simpledsl/api/DslParams.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,27 @@ static DslParams create(String[] args, DslArg... arguments)
6464
return new DslParamsParser().parse(args, arguments);
6565
}
6666

67+
/**
68+
* Create new {@link DslParams} from multiline args. Useful for passing java text blocks.
69+
*
70+
* <pre>
71+
* publicAPI.placeOrder("""
72+
* FTSE100
73+
* side: buy
74+
* quantity: 10
75+
* price: 5000
76+
* expectedStatus: UNMATCHED
77+
* """);
78+
* </pre>
79+
*
80+
* @param multilineArgs the values
81+
* @param arguments the {@link DslArg multilineArgs}
82+
* @return the new {@link DslParams}
83+
*/
84+
static DslParams create(String multilineArgs, DslArg... arguments)
85+
{
86+
return new DslParamsParser().parse(multilineArgs.split(System.lineSeparator()), arguments);
87+
}
6788

6889
/**
6990
* A shorthand way to create a {@link DslParams} instance that accepts a single required parameter and return the

0 commit comments

Comments
 (0)