/*
 * Copyright 2020, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.query;

import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.Immutable;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Defines the values of {@link Subject} subject identifiers.
 *
 * @param <I>
 *         the type of the identifiers
 */
@Immutable(containerOf = "I")
public final class IdParameter<I> {

    private final ImmutableSet<I> values;

    private IdParameter(ImmutableSet<I> values) {
        this.values = values;
    }

    public ImmutableSet<I> values() {
        return values;
    }

    public static <I> IdParameter<I> empty() {
        return new IdParameter<>(ImmutableSet.of());
    }

    public static <I> IdParameter<I> is(I value) {
        checkNotNull(value);
        return new IdParameter<>(ImmutableSet.of(value));
    }

    /**
     * Creates an instance of {@code IdParameter} with the identifier values restricted
     * to the passed one.
     *
     * @param values
     *         the identifier values to use
     * @param <I>
     *         the type of the identifier values
     * @return a new instance of this type
     */
    public static <I> IdParameter<I> in(ImmutableSet<I> values) {
        checkNotNull(values);
        return new IdParameter<>(values);
    }
}

@@ -1191,81 +1191,151 @@
 heck
-NotNull;%0A%0A/**%0A * Defines the values of %7B@link Subject%7D subject identifier
+Argument;%0Aimport static com.google.common.base.Preconditions.checkNotNull;%0A%0A/**%0A * Sets the identifiers of objects which a %7B@link Query%7D target
 s.%0A 
@@ -1598,178 +1598,799 @@
     
-public ImmutableSet%3CI%3E values() %7B%0A        return values;%0A    %7D%0A%0A    public static %3CI%3E IdParameter%3CI%3E empty() %7B%0A        return new IdParameter%3C%3E(ImmutableSet.of());%0A    %7D%0A
+/**%0A     * Returns the values of identifiers in this parameter.%0A     */%0A    public ImmutableSet%3CI%3E values() %7B%0A        return values;%0A    %7D%0A%0A    /**%0A     * Creates an new instance of this parameter without restricting it to any identifier values.%0A     *%0A     * @param %3CI%3E%0A     *         the type of the values, to satisfy the contract of a calling party%0A     * @return a new instance of this type%0A     */%0A    public static %3CI%3E IdParameter%3CI%3E empty() %7B%0A        return new IdParameter%3C%3E(ImmutableSet.of());%0A    %7D%0A%0A    /**%0A     * Creates a new instance restricting the parameter to a single identifier value.%0A     *%0A     * @param value%0A     *         the identifier value to use%0A     * @param %3CI%3E%0A     *         the type of the identifier value%0A     * @return a new instance of this type%0A     */
 %0A   
@@ -2555,17 +2555,20 @@
 reates a
-n
+ new
  instanc
@@ -2572,31 +2572,8 @@
 ance
- of %7B@code IdParameter%7D
  wit
@@ -2606,23 +2606,16 @@
 stricted
-%0A     *
  to the 
@@ -2624,12 +2624,8 @@
 ssed
- one
 .%0A  
@@ -2689,24 +2689,43 @@
 alues to use
+; must not be empty
 %0A     * @par
@@ -2923,24 +2923,106 @@
 ll(values);%0A
+        checkArgument(!values.isEmpty(), %22Identifier values must not be empty.%22);%0A
         retu

Document the type.