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

com.github.cowwoc.requirements.guava.MultimapValidator Maven / Gradle / Ivy

There is a newer version: 9.0.0
Show newest version
/*
 * Copyright (c) 2019 Gili Tzabari
 * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
 */
package com.github.cowwoc.requirements.guava;

import com.google.common.collect.Multimap;
import com.github.cowwoc.requirements.java.CollectionValidator;
import com.github.cowwoc.requirements.java.SizeValidator;
import com.github.cowwoc.requirements.java.extension.ExtensibleObjectValidator;

import java.util.Collection;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Consumer;

/**
 * Validates the requirements of a Multimap.
 *
 * @param  the type of key in the multimap
 * @param  the type of value in the multimap
 */
public interface MultimapValidator
	extends ExtensibleObjectValidator, Multimap>
{
	/**
	 * @return a validator over {@link Multimap#keySet()}
	 */
	CollectionValidator, K> keySet();

	/**
	 * Validates nested requirements. This mechanism can be used to
	 * 
	 * group related requirements.
	 *
	 * @param consumer validates the {@link Multimap#keySet()}
	 * @return the updated validator
	 */
	@SuppressWarnings("LongLine")
	MultimapValidator keySet(Consumer, K>> consumer);

	/**
	 * @return a validator over {@link Multimap#values()}
	 */
	CollectionValidator, V> values();

	/**
	 * Validates nested requirements. This mechanism can be used to
	 * 
	 * group related requirements.
	 *
	 * @param consumer validates the {@link Multimap#values()}
	 * @return the updated validator
	 */
	@SuppressWarnings("LongLine")
	MultimapValidator values(Consumer, V>> consumer);

	/**
	 * @return a validator over {@link Multimap#entries()}
	 */
	CollectionValidator>, Entry> entries();

	/**
	 * Validates nested requirements. This mechanism can be used to
	 * 
	 * group related requirements.
	 *
	 * @param consumer validates the {@link Multimap#entries()}
	 * @return the updated validator
	 */
	@SuppressWarnings("LongLine")
	MultimapValidator entries(
		Consumer>, Entry>> consumer);

	/**
	 * Ensures that the actual value is empty.
	 *
	 * @return the updated validator
	 * @throws IllegalArgumentException if actual value is not empty
	 */
	MultimapValidator isEmpty();

	/**
	 * Ensures that the actual value is not empty.
	 *
	 * @return the updated validator
	 * @throws IllegalArgumentException if actual value is empty
	 */
	MultimapValidator isNotEmpty();

	/**
	 * @return a validator over {@link Multimap#size()}
	 */
	SizeValidator size();

	/**
	 * Validates nested requirements. This mechanism can be used to
	 * 
	 * group related requirements.
	 *
	 * @param consumer validates the multimap's size
	 * @return the updated validator
	 */
	@SuppressWarnings("LongLine")
	MultimapValidator size(Consumer consumer);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy