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

com.deevvi.device.detector.model.client.Browser Maven / Gradle / Ivy

package com.deevvi.device.detector.model.client;

import com.google.common.base.Preconditions;

import java.util.Map;

/**
 * Model for browser parser.
 */
public final class Browser extends Client {

    /**
     * Map with browser engines.
     */
    private final Map engines;

    /**
     * Constructor.
     */
    private Browser(String name, String rawRegex, String version, Map engines) {

        super(name, rawRegex, version);
        Preconditions.checkNotNull(engines, "Engines map cannot be null or empty.");
        this.engines = engines;
    }

    /**
     * Get browser engines.
     *
     * @return browser engines.
     */
    public Map getEngines() {

        return engines;
    }

    /**
     * Builder class.
     */
    public static class Builder {
        private String name;
        private String rawRegex;
        private String version;
        private Map engine;

        public Builder() {
        }

        public Builder withName(String name) {

            this.name = name;
            return this;
        }

        public Builder withRawRegex(String rawRegex) {

            this.rawRegex = rawRegex;
            return this;
        }

        public Builder withVersion(String version) {

            this.version = version;
            return this;
        }

        public Builder withEngine(Map engine) {

            this.engine = engine;
            return this;
        }

        public Browser build() {

            return new Browser(name, rawRegex, version, engine);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy