public class GroovyMapFormatter
extends java.lang.Object
Format example: [key: "value", "complex key": 'another value', key3: null]
| Constructor and Description |
|---|
GroovyMapFormatter() |
| Modifier and Type | Method and Description |
|---|---|
static int |
doParse(java.lang.CharSequence s,
int startPos,
java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
The actual parser engine.
|
static java.lang.String |
format(java.util.Map.Entry<?,?> entry)
Formats a map entry to a Groovy-style string.
|
static java.lang.String |
format(java.util.Map<?,?> map)
Formats a map to a Groovy-style string.
|
static java.util.Map<java.lang.String,java.lang.String> |
parse(java.lang.String s)
Convenience wrapper that parses a Groovy-style map string into a LinkedHashMap.
|
static java.util.Map.Entry<java.lang.String,java.lang.String> |
parseEntry(java.lang.String s)
Parses a Groovy-style map string into a single Map.Entry.
|
public static java.lang.String format(java.util.Map<?,?> map)
Example: [key: 'value', 'complex key': 'another value', key3: null]
public static java.lang.String format(java.util.Map.Entry<?,?> entry)
Example: key: 'value', 'complex key': 'another value', key3: null
public static java.util.Map<java.lang.String,java.lang.String> parse(java.lang.String s)
public static java.util.Map.Entry<java.lang.String,java.lang.String> parseEntry(java.lang.String s)
s - The string to parse (e.g. "key: 'value'" or "[key: 'value']")java.lang.IllegalArgumentException - if the string contains more than one entry.public static int doParse(java.lang.CharSequence s,
int startPos,
java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
Iterates through a CharSequence starting at startPos, extracting key-value pairs and feeding them to the provided BiConsumer.
Copyright © 2000-2026 OAshi S.à r.l. All Rights Reserved.