我知道构造函数怎么写,但是枚举类型,枚举其他的对象,这里应该怎么添加呢?能不能给我以id为例,进行枚举的构造方法添加啊?不胜感激啊
package com.java;
public class Locator {
private String element;
private int waitSec;
public enum ByType {
xpath, id, linkText, name, className, cssSelector, partialLinkText, tagName
}
private ByType byType;
public Locator() {
}
public Locator(String element) {
this.element = element;
this.waitSec = 3;
this.byType = ByType.xpath;
}
public Locator(String element, int waitSec) {
this.waitSec = waitSec;
this.element = element;
this.byType = ByType.xpath;
}
public Locator(String element, int waitSec, ByType byType) {
this.waitSec = waitSec;
this.element = element;
this.byType = byType;
}
public String getElement() {
return element;
}
public int getWaitSec() {
return waitSec;
}
public ByType getBy() {
return byType;
}
public void setBy(ByType byType) {
this.byType = byType;
}
public void setReplace(String rep, String rex)
{
StringTools.replaceAll(element, rex, rep);
}
}