package Specification.Galaxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import FileOps.XStream.AdvancedXStreamHandler;
import Galaxy.Tree.Tool.Command.Command;
import Galaxy.Tree.Tool.Input.Other.Display;
import Galaxy.Tree.Tool.Input.Param.Option;
/**
* This handler handles the tool display field properly,
* correctly accounting for the value field inside display tag.
* @author viper
*
*/
public class DisplayHandler extends AdvancedXStreamHandler{
public DisplayHandler(){
super(Display.class);
}
@Override
public Map<String, String> mapFromObject(Object o) {
// TODO Auto-generated method stub
Display c = (Display) o;
Map<String, String> myMapping;
myMapping = new HashMap<String, String>();
myMapping.put(NAME_TAG, "option");
myMapping.put(VALUE_TAG, c.getContents());
return myMapping;
}
@Override
public Object mapToObject(Map<String, String> attributes) {
Display disp;
String contents;
List<String> tokens = new ArrayList();
final String val;
contents = attributes.get(VALUE_TAG);
disp = new Display(contents);
return disp;
}
}