1/*
2 * Copyright (C) 2013 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.common.collect.testing.google;
18
19import com.google.common.annotations.GwtCompatible;
20import com.google.common.collect.Multimap;
21import com.google.common.collect.testing.Helpers;
22import com.google.common.collect.testing.features.Feature;
23import com.google.common.collect.testing.features.TesterAnnotation;
24
25import java.lang.annotation.Inherited;
26import java.lang.annotation.Retention;
27import java.lang.annotation.RetentionPolicy;
28import java.util.Set;
29
30/**
31 * Optional features of classes derived from {@code Multimap}.
32 *
33 * @author Louis Wasserman
34 */
35// Enum values use constructors with generic varargs.
36@SuppressWarnings("unchecked")
37@GwtCompatible
38public enum MultimapFeature implements Feature<Multimap> {
39  VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE;
40
41  private final Set<Feature<? super Multimap>> implied;
42
43  MultimapFeature(Feature<? super Multimap> ... implied) {
44    this.implied = Helpers.copyToSet(implied);
45  }
46
47  @Override
48  public Set<Feature<? super Multimap>> getImpliedFeatures() {
49    return implied;
50  }
51
52  @Retention(RetentionPolicy.RUNTIME)
53  @Inherited
54  @TesterAnnotation
55  public @interface Require {
56    public abstract MultimapFeature[] value() default {};
57    public abstract MultimapFeature[] absent() default {};
58  }
59}
60