org.sahagin.share.srctree.code.CodeLine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sahagin Show documentation
Show all versions of sahagin Show documentation
Sahagin makes your Selenium script more readable and maintainable.
package org.sahagin.share.srctree.code;
import java.util.HashMap;
import java.util.Map;
import org.sahagin.share.yaml.YamlConvertException;
import org.sahagin.share.yaml.YamlConvertible;
import org.sahagin.share.yaml.YamlUtils;
public class CodeLine implements YamlConvertible {
// line start from 1
private int startLine;
private int endLine;
private Code code;
public int getStartLine() {
return startLine;
}
public void setStartLine(int startLine) {
this.startLine = startLine;
}
public int getEndLine() {
return endLine;
}
public void setEndLine(int endLine) {
this.endLine = endLine;
}
public Code getCode() {
return code;
}
public void setCode(Code code) {
this.code = code;
}
public Map toYamlObject() {
Map result = new HashMap(4);
result.put("startLine", startLine);
result.put("endLine", endLine);
result.put("code", code.toYamlObject());
return result;
}
public void fromYamlObject(Map yamlObject) throws YamlConvertException {
startLine = YamlUtils.getIntValue(yamlObject, "startLine");
endLine = YamlUtils.getIntValue(yamlObject, "endLine");
code = Code.newInstanceFromYamlObject(YamlUtils.getYamlObjectValue(yamlObject, "code"));
}
}