Home | History | Annotate | Download | only in collect
      1 /*
      2  * Copyright (C) 2009 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 
     17 package com.google.common.collect;
     18 
     19 import com.google.common.annotations.GwtCompatible;
     20 
     21 /**
     22  * "Overrides" the {@link ImmutableMap} static methods that lack
     23  * {@link ImmutableSortedMap} equivalents with deprecated, exception-throwing
     24  * versions. See {@link ImmutableSortedSetFauxverideShim} for details.
     25  *
     26  * @author Chris Povirk
     27  */
     28 @GwtCompatible
     29 abstract class ImmutableSortedMapFauxverideShim<K, V>
     30     extends ImmutableMap<K, V> {
     31   /**
     32    * Not supported. Use {@link ImmutableSortedMap#naturalOrder}, which offers
     33    * better type-safety, instead. This method exists only to hide
     34    * {@link ImmutableMap#builder} from consumers of {@code ImmutableSortedMap}.
     35    *
     36    * @throws UnsupportedOperationException always
     37    * @deprecated Use {@link ImmutableSortedMap#naturalOrder}, which offers
     38    *     better type-safety.
     39    */
     40   @Deprecated public static <K, V> ImmutableSortedMap.Builder<K, V> builder() {
     41     throw new UnsupportedOperationException();
     42   }
     43 
     44   /**
     45    * Not supported. <b>You are attempting to create a map that may contain a
     46    * non-{@code Comparable} key.</b> Proper calls will resolve to the version in
     47    * {@code ImmutableSortedMap}, not this dummy version.
     48    *
     49    * @throws UnsupportedOperationException always
     50    * @deprecated <b>Pass a key of type {@code Comparable} to use {@link
     51    *     ImmutableSortedMap#of(Comparable, Object)}.</b>
     52    */
     53   @Deprecated public static <K, V> ImmutableSortedMap<K, V> of(K k1, V v1) {
     54     throw new UnsupportedOperationException();
     55   }
     56 
     57   /**
     58    * Not supported. <b>You are attempting to create a map that may contain
     59    * non-{@code Comparable} keys.</b> Proper calls will resolve to the version
     60    * in {@code ImmutableSortedMap}, not this dummy version.
     61    *
     62    * @throws UnsupportedOperationException always
     63    * @deprecated <b>Pass keys of type {@code Comparable} to use {@link
     64    *     ImmutableSortedMap#of(Comparable, Object, Comparable, Object)}.</b>
     65    */
     66   @Deprecated public static <K, V> ImmutableSortedMap<K, V> of(
     67       K k1, V v1, K k2, V v2) {
     68     throw new UnsupportedOperationException();
     69   }
     70 
     71   /**
     72    * Not supported. <b>You are attempting to create a map that may contain
     73    * non-{@code Comparable} keys.</b> Proper calls to will resolve to the
     74    * version in {@code ImmutableSortedMap}, not this dummy version.
     75    *
     76    * @throws UnsupportedOperationException always
     77    * @deprecated <b>Pass keys of type {@code Comparable} to use {@link
     78    *     ImmutableSortedMap#of(Comparable, Object, Comparable, Object,
     79    *     Comparable, Object)}.</b>
     80    */
     81   @Deprecated public static <K, V> ImmutableSortedMap<K, V> of(
     82       K k1, V v1, K k2, V v2, K k3, V v3) {
     83     throw new UnsupportedOperationException();
     84   }
     85 
     86   /**
     87    * Not supported. <b>You are attempting to create a map that may contain
     88    * non-{@code Comparable} keys.</b> Proper calls will resolve to the version
     89    * in {@code ImmutableSortedMap}, not this dummy version.
     90    *
     91    * @throws UnsupportedOperationException always
     92    * @deprecated <b>Pass keys of type {@code Comparable} to use {@link
     93    *     ImmutableSortedMap#of(Comparable, Object, Comparable, Object,
     94    *     Comparable, Object, Comparable, Object)}.</b>
     95    */
     96   @Deprecated public static <K, V> ImmutableSortedMap<K, V> of(
     97       K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
     98     throw new UnsupportedOperationException();
     99   }
    100 
    101   /**
    102    * Not supported. <b>You are attempting to create a map that may contain
    103    * non-{@code Comparable} keys.</b> Proper calls will resolve to the version
    104    * in {@code ImmutableSortedMap}, not this dummy version.
    105    *
    106    * @throws UnsupportedOperationException always
    107    * @deprecated <b>Pass keys of type {@code Comparable} to use {@link
    108    *     ImmutableSortedMap#of(Comparable, Object, Comparable, Object,
    109    *     Comparable, Object, Comparable, Object, Comparable, Object)}.</b>
    110    */
    111   @Deprecated public static <K, V> ImmutableSortedMap<K, V> of(
    112       K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
    113     throw new UnsupportedOperationException();
    114   }
    115 
    116   // No copyOf() fauxveride; see ImmutableSortedSetFauxverideShim.
    117 }
    118