Class MapToStringTransformer
- java.lang.Object
-
- org.biojava.nbio.ws.alignment.qblast.MapToStringTransformer
-
public class MapToStringTransformer extends Object
Transforms Map to String. Used by NCBIQBlastService to join given map of arguments to a single String to pass to QBlast service- Author:
- Gediminas Rimsa
-
-
Constructor Summary
Constructors Constructor Description MapToStringTransformer()
CreatesMapToStringTransformer
with defaults:MapToStringTransformer(String mappingSequence, String separatorSequence, String nullValue)
CreatesMapToStringTransformer
with given values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMappingSequence()
String
getNullValue()
String
getSeparatorSequence()
void
setMappingSequence(String mappingSequence)
void
setNullValue(String nullValue)
void
setSeparatorSequence(String separatorSequence)
String
transform(Map<?,?> map)
TransformsMap
toString
, representing every entry askey
mappingSequence
value
, joined byseparatorSequence
-
-
-
Constructor Detail
-
MapToStringTransformer
public MapToStringTransformer()
CreatesMapToStringTransformer
with defaults:mappingSequence = "="; separatorSequence = "&"; nullValue = "null";
-
MapToStringTransformer
public MapToStringTransformer(String mappingSequence, String separatorSequence, String nullValue)
CreatesMapToStringTransformer
with given values- Parameters:
mappingSequence
- sequence inserted betweenkey
andvalue
separatorSequence
- sequence inserted between every pair ofMap
entriesnullValue
- sequence inserted for everynull
key or value
-
-
Method Detail
-
transform
public String transform(Map<?,?> map)
TransformsMap
toString
, representing every entry askey
mappingSequence
value
, joined byseparatorSequence
Calls
toString()
for keys and values, replacingnull
with the value ofnullValue
propertyFor example, if we have a map with two entries:
("key1", "1")
and("key2", "2")
this method would return"key1=1&key2=2"
ifmappingSequence
is "=" and separator sequence is "&";- Parameters:
map
- map of arguments- Returns:
- String resulting string
-
getMappingSequence
public String getMappingSequence()
-
setMappingSequence
public void setMappingSequence(String mappingSequence)
-
getSeparatorSequence
public String getSeparatorSequence()
-
setSeparatorSequence
public void setSeparatorSequence(String separatorSequence)
-
getNullValue
public String getNullValue()
-
setNullValue
public void setNullValue(String nullValue)
-
-