public class MapToStringTransformer extends Object
Constructor and Description |
---|
MapToStringTransformer()
Creates
MapToStringTransformer with defaults:
mappingSequence = "=";
separatorSequence = "&";
nullValue = "null";
|
MapToStringTransformer(String mappingSequence,
String separatorSequence,
String nullValue)
Creates
MapToStringTransformer with given values |
Modifier and Type | Method and Description |
---|---|
String |
getMappingSequence() |
String |
getNullValue() |
String |
getSeparatorSequence() |
void |
setMappingSequence(String mappingSequence) |
void |
setNullValue(String nullValue) |
void |
setSeparatorSequence(String separatorSequence) |
String |
transform(Map<?,?> map)
Transforms
Map to String , representing every entry as
key mappingSequence value , joined by
separatorSequence
Calls toString() for keys and values, replacing null with
the value of nullValue property
For example, if we have a map with two entries: ("key1", "1") and
("key2", "2") this method would return "key1=1&key2=2" if
mappingSequence is "=" and separator sequence is "&"; |
public MapToStringTransformer()
MapToStringTransformer
with defaults:
mappingSequence = "="; separatorSequence = "&"; nullValue = "null";
public MapToStringTransformer(String mappingSequence, String separatorSequence, String nullValue)
MapToStringTransformer
with given valuesmappingSequence
- sequence inserted between key
and
value
separatorSequence
- sequence inserted between every pair of
Map
entriesnullValue
- sequence inserted for every null
key or valuepublic String transform(Map<?,?> map)
Map
to String
, representing every entry as
key
mappingSequence
value
, joined by
separatorSequence
Calls toString()
for keys and values, replacing null
with
the value of nullValue
property
For example, if we have a map with two entries: ("key1", "1")
and
("key2", "2")
this method would return "key1=1&key2=2"
if
mappingSequence
is "=" and separator sequence is "&";
map
- map of argumentspublic String getMappingSequence()
public void setMappingSequence(String mappingSequence)
public String getSeparatorSequence()
public void setSeparatorSequence(String separatorSequence)
public String getNullValue()
public void setNullValue(String nullValue)
Copyright © 2000–2018 BioJava. All rights reserved.