List of usage examples for org.openqa.selenium Platform getPartOfOsName
public String[] getPartOfOsName()
From source file:org.openqa.grid.internal.utils.DefaultCapabilityMatcher.java
License:Apache License
Platform extractPlatform(Object o) {
if (o == null) {
return null;
}/* w w w.ja va2 s. c o m*/
if (o instanceof Platform) {
return (Platform) o;
} else if (o instanceof String) {
String name = o.toString();
try {
return Platform.valueOf(name);
} catch (IllegalArgumentException e) {
// no exact match, continue to look for a partial match
}
for (Platform os : Platform.values()) {
for (String matcher : os.getPartOfOsName()) {
if ("".equals(matcher))
continue;
if (name.equalsIgnoreCase(matcher)) {
return os;
}
}
}
return null;
} else {
return null;
}
}