Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Preconditions.java

Issue 2035303002: [Chromoting] Decouple DesktopView and TouchInputHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync latest changes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chromoting; 5 package org.chromium.chromoting;
6 6
7 /** 7 /**
8 * A set of helper functions to write assertions. These functions are always bei ng executed, and 8 * A set of helper functions to write assertions. These functions are always bei ng executed, and
9 * will not ignored in release build. 9 * will not ignored in release build.
10 */ 10 */
11 11
12 public final class Preconditions { 12 public final class Preconditions {
13 // This class contains only static functions, so it should not be instantiat ed. 13 // This class contains only static functions, so it should not be instantiat ed.
14 private Preconditions() {} 14 private Preconditions() {}
15 15
16 /** 16 /**
17 * Checks whether input |value| is true, and returns its value. Throws 17 * Checks whether input |value| is true, and returns its value. Throws
18 * {@link IllegalStateException} if |value| is false. 18 * {@link IllegalStateException} if |value| is false.
19 */ 19 */
20 public static final boolean isTrue(boolean value) { 20 public static final boolean isTrue(boolean value) {
21 if (!value) { 21 if (!value) {
22 throw new IllegalStateException(); 22 throw new IllegalStateException();
23 } 23 }
24 return value; 24 return value;
25 } 25 }
26 26
27 /** 27 /**
28 * Checks whether input |ref| is not a null reference, and return its value. Throws 28 * Checks whether input |ref| is not a null reference, and returns its value . Throws
29 * {@link NullPointerException} if |ref| is null. 29 * {@link NullPointerException} if |ref| is null.
30 */ 30 */
31 public static final <T> T notNull(T ref) { 31 public static final <T> T notNull(T ref) {
32 if (ref == null) { 32 if (ref == null) {
33 throw new NullPointerException(); 33 throw new NullPointerException();
34 } 34 }
35 return ref; 35 return ref;
36 } 36 }
37
38 /**
39 * Checks whether input |ref| is a null reference, and returns its value. Th rows
40 * {@link IllegalArgumentException} if |ref| is not null.
41 */
42 public static final <T> T isNull(T ref) {
43 if (ref != null) {
44 throw new IllegalArgumentException();
45 }
46 return ref;
47 }
37 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698