001/*
002 * Copyright (C) 2011 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License
010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011 * or implied. See the License for the specific language governing permissions and limitations under
012 * the License.
013 */
014
015package com.google.common.hash;
016
017import com.google.common.annotations.Beta;
018
019import java.io.Serializable;
020
021/**
022 * Static factories for creating {@link HashCode} instances; most users should never have to use
023 * this. All returned instances are {@link Serializable}.
024 *
025 * @author Dimitris Andreou
026 * @since 12.0
027 * @deprecated Use the duplicated methods in {@link HashCode} instead. This class is scheduled
028 *     to be removed in Guava 16.0.
029 */
030@Beta
031@Deprecated
032public final class HashCodes {
033  private HashCodes() {}
034
035  /**
036   * Creates a 32-bit {@code HashCode}, of which the bytes will form the passed int, interpreted
037   * in little endian order.
038   *
039   * @deprecated Use {@link HashCode#fromInt} instead. This method is scheduled to be removed in
040   *     Guava 16.0.
041   */
042  @Deprecated
043  public static HashCode fromInt(int hash) {
044    return HashCode.fromInt(hash);
045  }
046
047  /**
048   * Creates a 64-bit {@code HashCode}, of which the bytes will form the passed long, interpreted
049   * in little endian order.
050   *
051   * @deprecated Use {@link HashCode#fromLong} instead. This method is scheduled to be removed in
052   *     Guava 16.0.
053   */
054  @Deprecated
055  public static HashCode fromLong(long hash) {
056    return HashCode.fromLong(hash);
057  }
058
059  /**
060   * Creates a {@code HashCode} from a byte array. The array is defensively copied to preserve
061   * the immutability contract of {@code HashCode}. The array cannot be empty.
062   *
063   * @deprecated Use {@link HashCode#fromBytes} instead. This method is scheduled to be removed in
064   *     Guava 16.0.
065   */
066  @Deprecated
067  public static HashCode fromBytes(byte[] bytes) {
068    return HashCode.fromBytes(bytes);
069  }
070}