54
54
* Represents a set of keyword arguments, typically used for interfacing with Python functions that
55
55
* accept {@code **kwargs}.
56
56
*
57
- * <h3>When to Use</h3>
58
- * {@link KeywordArguments} must be used whenever a Python function accepts
57
+ * <h3>When to Use</h3> {@link KeywordArguments} must be used whenever a Python function accepts
59
58
* named arguments (both required and optional). This ensures proper mapping of Java arguments to
60
59
* Python function parameters, especially when working with Python methods that utilize
61
60
* {@code **kwargs}.
62
61
*
63
- * <p><b>Important:</b> An instance of {@link KeywordArguments} must always be the last argument when
62
+ * <p>
63
+ * <b>Important:</b> An instance of {@link KeywordArguments} must always be the last argument when
64
64
* invoking a Python function. It may be preceded by an instance of {@link PositionalArguments}, but
65
65
* {@link KeywordArguments} must always be the final argument. This ensures proper alignment with
66
- * Python's argument structure.</p>
66
+ * Python's argument structure.
67
+ * </p>
67
68
*
68
- * <p>The {@link KeywordArguments} class provides factory methods to create instances from a
69
- * {@link Map} or by directly specifying key-value pairs.</p>
69
+ * <p>
70
+ * The {@link KeywordArguments} class provides factory methods to create instances from a
71
+ * {@link Map} or by directly specifying key-value pairs.
72
+ * </p>
70
73
*
71
74
* <h3>Usage</h3>
72
75
*
73
- * <p>Consider the following Python function:</p>
76
+ * <p>
77
+ * Consider the following Python function:
78
+ * </p>
79
+ *
74
80
* <pre>{@code
75
81
* def example_function(*, named1, named2, named3=None, named4=42):
76
82
* ...
77
83
* }</pre>
78
84
*
79
- * <p>In this function, <code>named1</code> and <code>named2</code> are required keyword arguments,
80
- * while <code>named3</code> and <code>named4</code> are optional because they have default values.</p>
85
+ * <p>
86
+ * In this function, <code>named1</code> and <code>named2</code> are required keyword arguments,
87
+ * while <code>named3</code> and <code>named4</code> are optional because they have default values.
88
+ * </p>
81
89
*
82
- * <p>From Java, this function can be invoked as:</p>
90
+ * <p>
91
+ * From Java, this function can be invoked as:
92
+ * </p>
93
+ *
83
94
* <pre>{@code
84
95
* value.invokeMember("example_function", kwArgs);
85
96
* }</pre>
86
97
*
87
- * <p>The variable <code>kwArgs</code> can be created in several ways:</p>
98
+ * <p>
99
+ * The variable <code>kwArgs</code> can be created in several ways:
100
+ * </p>
88
101
*
89
- * <p><b>Using a map:</b></p>
102
+ * <p>
103
+ * <b>Using a map:</b>
104
+ * </p>
105
+ *
90
106
* <pre>{@code
91
107
* KeywordArguments kwargs = KeywordArguments.from(
92
- * Map.of("named1", 10, "named2", "value", "named4", 100)
93
- * );
108
+ * Map.of("named1", 10, "named2", "value", "named4", 100));
94
109
* }</pre>
95
110
*
96
- * <p><b>Using key-value pairs:</b></p>
111
+ * <p>
112
+ * <b>Using key-value pairs:</b>
113
+ * </p>
114
+ *
97
115
* <pre>{@code
98
116
* KeywordArguments kwargs = KeywordArguments.of(
99
- * "named1", 10, "named2", "value", "named4", 100
100
- * );
117
+ * "named1", 10, "named2", "value", "named4", 100);
101
118
* }</pre>
102
119
*
103
- * <p><b>Using a builder:</b></p>
120
+ * <p>
121
+ * <b>Using a builder:</b>
122
+ * </p>
123
+ *
104
124
* <pre>{@code
105
125
* public static final class ExampleFunctionKwArgsBuilder {
106
126
* private final Map<String, Object> values = new HashMap<>();
135
155
* }
136
156
* }</pre>
137
157
*
138
- * <p><b>Using the builder to create the arguments:</b></p>
158
+ * <p>
159
+ * <b>Using the builder to create the arguments:</b>
160
+ * </p>
161
+ *
139
162
* <pre>{@code
140
163
* KeywordArguments kwargs = new ExampleFunctionKwArgsBuilder("value1", "value2") // Required keys
141
- * .named4(100) // Optional key
142
- * .add("dynamicKey", 42) // Dynamic key
143
- * .build();
164
+ * .named4(100) // Optional key
165
+ * .add("dynamicKey", 42) // Dynamic key
166
+ * .build();
144
167
* }</pre>
145
168
*
146
169
* @see PositionalArguments
@@ -332,7 +355,8 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
332
355
* @param value2 the value of the second argument
333
356
* @param name3 the name of the third argument
334
357
* @param value3 the value of the third argument
335
- * ... (similar for other parameters) ...
358
+ * @param name4 the name of the fourth argument
359
+ * @param value4 the value of the fourth argument
336
360
* @return a new {@link KeywordArguments} instance containing the specified arguments
337
361
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object)
338
362
*/
@@ -349,9 +373,13 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
349
373
* @param value2 the value of the second argument
350
374
* @param name3 the name of the third argument
351
375
* @param value3 the value of the third argument
352
- * ... (similar for other parameters) ...
376
+ * @param name4 the name of the fourth argument
377
+ * @param value4 the value of the fourth argument
378
+ * @param name5 the name of the fifth argument
379
+ * @param value5 the value of the fifth argument
353
380
* @return a new {@link KeywordArguments} instance containing the specified arguments
354
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
381
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
382
+ * Object)
355
383
*/
356
384
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
357
385
String name5 , Object value5 ) {
@@ -368,9 +396,15 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
368
396
* @param value2 the value of the second argument
369
397
* @param name3 the name of the third argument
370
398
* @param value3 the value of the third argument
371
- * ... (similar for other parameters) ...
399
+ * @param name4 the name of the fourth argument
400
+ * @param value4 the value of the fourth argument
401
+ * @param name5 the name of the fifth argument
402
+ * @param value5 the value of the fifth argument
403
+ * @param name6 the name of the sixth argument
404
+ * @param value6 the value of the sixth argument
372
405
* @return a new {@link KeywordArguments} instance containing the specified arguments
373
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
406
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
407
+ * Object, Object, Object)
374
408
*/
375
409
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
376
410
String name5 , Object value5 , String name6 , Object value6 ) {
@@ -387,9 +421,17 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
387
421
* @param value2 the value of the second argument
388
422
* @param name3 the name of the third argument
389
423
* @param value3 the value of the third argument
390
- * ... (similar for other parameters) ...
424
+ * @param name4 the name of the fourth argument
425
+ * @param value4 the value of the fourth argument
426
+ * @param name5 the name of the fifth argument
427
+ * @param value5 the value of the fifth argument
428
+ * @param name6 the name of the sixth argument
429
+ * @param value6 the value of the sixth argument
430
+ * @param name7 the name of the seventh argument
431
+ * @param value7 the value of the seventh argument
391
432
* @return a new {@link KeywordArguments} instance containing the specified arguments
392
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
433
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
434
+ * Object, Object, Object, Object, Object)
393
435
*/
394
436
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
395
437
String name5 , Object value5 , String name6 , Object value6 , String name7 , Object value7 ) {
@@ -406,9 +448,19 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
406
448
* @param value2 the value of the second argument
407
449
* @param name3 the name of the third argument
408
450
* @param value3 the value of the third argument
409
- * ... (similar for other parameters) ...
451
+ * @param name4 the name of the fourth argument
452
+ * @param value4 the value of the fourth argument
453
+ * @param name5 the name of the fifth argument
454
+ * @param value5 the value of the fifth argument
455
+ * @param name6 the name of the sixth argument
456
+ * @param value6 the value of the sixth argument
457
+ * @param name7 the name of the seventh argument
458
+ * @param value7 the value of the seventh argument
459
+ * @param name8 the name of the eighth argument
460
+ * @param value8 the value of the eighth argument
410
461
* @return a new {@link KeywordArguments} instance containing the specified arguments
411
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
462
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
463
+ * Object, Object, Object, Object, Object, Object, Object)
412
464
*/
413
465
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
414
466
String name5 , Object value5 , String name6 , Object value6 , String name7 , Object value7 , String name8 , Object value8 ) {
@@ -425,9 +477,21 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
425
477
* @param value2 the value of the second argument
426
478
* @param name3 the name of the third argument
427
479
* @param value3 the value of the third argument
428
- * ... (similar for other parameters) ...
480
+ * @param name4 the name of the fourth argument
481
+ * @param value4 the value of the fourth argument
482
+ * @param name5 the name of the fifth argument
483
+ * @param value5 the value of the fifth argument
484
+ * @param name6 the name of the sixth argument
485
+ * @param value6 the value of the sixth argument
486
+ * @param name7 the name of the seventh argument
487
+ * @param value7 the value of the seventh argument
488
+ * @param name8 the name of the eighth argument
489
+ * @param value8 the value of the eighth argument
490
+ * @param name9 the name of the ninth argument
491
+ * @param value9 the value of the ninth argument
429
492
* @return a new {@link KeywordArguments} instance containing the specified arguments
430
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
493
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
494
+ * Object, Object, Object, Object, Object, Object, Object, Object, Object)
431
495
*/
432
496
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
433
497
String name5 , Object value5 , String name6 , Object value6 , String name7 , Object value7 , String name8 , Object value8 ,
@@ -445,9 +509,23 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
445
509
* @param value2 the value of the second argument
446
510
* @param name3 the name of the third argument
447
511
* @param value3 the value of the third argument
448
- * ... (similar for other parameters) ...
512
+ * @param name4 the name of the fourth argument
513
+ * @param value4 the value of the fourth argument
514
+ * @param name5 the name of the fifth argument
515
+ * @param value5 the value of the fifth argument
516
+ * @param name6 the name of the sixth argument
517
+ * @param value6 the value of the sixth argument
518
+ * @param name7 the name of the seventh argument
519
+ * @param value7 the value of the seventh argument
520
+ * @param name8 the name of the eighth argument
521
+ * @param value8 the value of the eighth argument
522
+ * @param name9 the name of the ninth argument
523
+ * @param value9 the value of the ninth argument
524
+ * @param name10 the name of the tenth argument
525
+ * @param value10 the value of the tenth argument
449
526
* @return a new {@link KeywordArguments} instance containing the specified arguments
450
- * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
527
+ * @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
528
+ * Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
451
529
*/
452
530
public static KeywordArguments of (String name1 , Object value1 , String name2 , Object value2 , String name3 , Object value3 , String name4 , Object value4 ,
453
531
String name5 , Object value5 , String name6 , Object value6 , String name7 , Object value7 , String name8 , Object value8 ,
0 commit comments