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;
import java.util.regex.Pattern;

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

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

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

        super(name, pattern, 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 Pattern pattern;
        private String version;
        private Map engine;

        public Builder() {
        }

        public Builder withName(String name) {

            this.name = name;
            return this;
        }

        public Builder withPattern(Pattern pattern) {

            this.pattern = pattern;
            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, pattern, version, engine);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy