All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.nscuro.wdm.binary.firefox.GeckoDriverPlatform Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package com.github.nscuro.wdm.binary.firefox;

import com.github.nscuro.wdm.Architecture;
import com.github.nscuro.wdm.Os;
import com.github.nscuro.wdm.Platform;

import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static java.util.Collections.singletonList;

enum GeckoDriverPlatform implements Platform {

    WIN32(Os.WINDOWS, singletonList(Architecture.X86)),

    WIN64(Os.WINDOWS, singletonList(Architecture.X64)),

    LINUX32(Os.LINUX, singletonList(Architecture.X86)),

    LINUX64(Os.LINUX, singletonList(Architecture.X64)),

    MACOS(Os.MACOS, singletonList(Architecture.X64));

    private final Os os;

    private final List architectures;

    GeckoDriverPlatform(final Os os, final List architectures) {
        this.os = os;
        this.architectures = architectures;
    }

    static GeckoDriverPlatform valueOf(final Os os, final Architecture architecture) {
        return Arrays.stream(values())
                .filter(platform -> platform.os.equals(os))
                .filter(platform -> platform.architectures.contains(architecture))
                .findAny()
                .orElseThrow(IllegalArgumentException::new);
    }

    @Nonnull
    @Override
    public String getName() {
        return name().toLowerCase();
    }

    @Nonnull
    @Override
    public Os getOs() {
        return os;
    }

    @Nonnull
    @Override
    public Set getArchitectures() {
        return new HashSet<>(architectures);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy