Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ObjectUtils | 28 | 6 | 0% | 7 | 15 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.component.util; | |
21 | ||
22 | /** | |
23 | * Various Object utilities. | |
24 | * | |
25 | * @version $Id: e98e004e29b1d6656d3e0d89dfe9137155879810 $ | |
26 | * @since 2.1RC1 | |
27 | */ | |
28 | public final class ObjectUtils | |
29 | { | |
30 | /** | |
31 | * Utility class. | |
32 | */ | |
33 | 0 | ![]() |
34 | { | |
35 | // Utility class | |
36 | } | |
37 | ||
38 | /** | |
39 | * Check if provided object are equals. This method also take care of null. | |
40 | * | |
41 | * @param object1 the first object | |
42 | * @param object2 the second object | |
43 | * @return true of the provided objects are equal | |
44 | * @deprecated use {@link java.util.Objects#equals(Object, Object)} instead | |
45 | */ | |
46 | 0 | ![]() |
47 | public static boolean equals(Object object1, Object object2) | |
48 | { | |
49 | 0 | if (object1 == object2) { |
50 | 0 | return true; |
51 | } | |
52 | ||
53 | 0 | if (object1 == null || object2 == null) { |
54 | 0 | return false; |
55 | } | |
56 | ||
57 | 0 | return object1.equals(object2); |
58 | } | |
59 | ||
60 | /** | |
61 | * @param object the object | |
62 | * @return the provided object hash code or 0 of the object is null | |
63 | * @deprecated use {@link java.util.Objects#hashCode(Object)} instead | |
64 | */ | |
65 | 0 | ![]() |
66 | public static int hasCode(Object object) | |
67 | { | |
68 | 0 | return object == null ? 0 : object.hashCode(); |
69 | } | |
70 | } |