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 Details

    • MapToStringTransformer

      public MapToStringTransformer()
      Creates MapToStringTransformer with defaults:
       mappingSequence = "=";
       separatorSequence = "&";
       nullValue = "null";
       
    • MapToStringTransformer

      public MapToStringTransformer(String mappingSequence, String separatorSequence, String nullValue)
      Creates MapToStringTransformer with given values
      Parameters:
      mappingSequence - sequence inserted between key and value
      separatorSequence - sequence inserted between every pair of Map entries
      nullValue - sequence inserted for every null key or value
  • Method Details

    • transform

      public 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 "&";

      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)