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

com.visenze.visearch.ColorSearchParams Maven / Gradle / Ivy

There is a newer version: 1.14.5
Show newest version
package com.visenze.visearch;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Multimap;

public class ColorSearchParams extends BaseSearchParams {

    private String color;

    public ColorSearchParams(String color) {
        super();
        setColor(color);
    }

    private void setColor(String color) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(color), "color must not be null or empty.");
        Preconditions.checkArgument(color.matches("^[0-9a-fA-F]{6}$"), "Invalid color. " +
                "It should be a six hexadecimal number color code e.g. 123ACF.");
        this.color = color;
    }

    public String getColor() {
        return color;
    }

    @Override
    public Multimap toMap() {
        Multimap map = super.toMap();
        map.put("color", color);
        return map;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy