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

com.deevvi.device.detector.model.VendorFragments Maven / Gradle / Ivy

Go to download

The aim of this library is to fetch as much as possible information from a user-agent string.

There is a newer version: 1.14.0
Show newest version
package com.deevvi.device.detector.model;

import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.regex.Pattern;

/**
 * Model for vendor fragments.
 */
public final class VendorFragments {

    private final String vendor;
    private final List patterns;

    /**
     * Constructor.
     */
    private VendorFragments(String vendor, List patterns) {

        Preconditions.checkNotNull(StringUtils.trimToNull(vendor), "Vendor cannot be null or empty.");
        Preconditions.checkNotNull(patterns, "Pattern list cannot be null.");

        this.vendor = vendor;
        this.patterns = patterns;
    }

    public String getVendor() {

        return vendor;
    }

    public List getPatterns() {

        return patterns;
    }

    /**
     * Builder class.
     */
    public static class Builder {

        private String vendor;
        private List patterns;

        public Builder withVendor(String vendor) {

            this.vendor = vendor;
            return this;
        }

        public Builder withPatterns(List patterns) {

            this.patterns = patterns;
            return this;
        }

        public VendorFragments build() {

            return new VendorFragments(vendor, patterns);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy