Example usage for org.openqa.selenium Platform getPartOfOsName

List of usage examples for org.openqa.selenium Platform getPartOfOsName

Introduction

In this page you can find the example usage for org.openqa.selenium Platform getPartOfOsName.

Prototype

public String[] getPartOfOsName() 

Source Link

Usage

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;
    }
}