Lines Matching +full:is +full:- +full:reference
8 * http://www.apache.org/licenses/LICENSE-2.0
11 * distributed under the License is distributed on an "AS IS" BASIS,
21 * An adaptation of Guava's {@code com.google.common.base.Preconditions} that is specially tailored
26 * Ensures that an object reference passed as a parameter to the calling method is not null.
28 * @param reference an object reference
29 * @return the non-null reference that was validated
30 * @throws NullPointerException if {@code reference} is null
32 public static <T> T checkNotNull(T reference) { in checkNotNull() argument
33 if (reference == null) { in checkNotNull()
36 return reference; in checkNotNull()
40 * Ensures that an object reference passed as a parameter to the calling method is not null.
42 * @param reference an object reference
44 * @return the non-null reference that was validated
45 * @throws NullPointerException if {@code reference} is null
47 public static <T> T checkNotNull(T reference, String errorMessage) { in checkNotNull() argument
48 if (reference == null) { in checkNotNull()
51 return reference; in checkNotNull()
55 * Ensures that an object reference returned from a provides method is not null.
57 * @param reference an object reference
58 * @return the non-null reference that was validated
59 * @throws NullPointerException if {@code reference} is null
61 public static <T> T checkNotNullFromProvides(T reference) { in checkNotNullFromProvides() argument
62 if (reference == null) { in checkNotNullFromProvides()
63 throw new NullPointerException("Cannot return null from a non-@Nullable @Provides method"); in checkNotNullFromProvides()
65 return reference; in checkNotNullFromProvides()
69 * Ensures that an object reference returned from a component method is not null.
71 * @param reference an object reference
72 * @return the non-null reference that was validated
73 * @throws NullPointerException if {@code reference} is null
75 public static <T> T checkNotNullFromComponent(T reference) { in checkNotNullFromComponent() argument
76 if (reference == null) { in checkNotNullFromComponent()
77 throw new NullPointerException("Cannot return null from a non-@Nullable component method"); in checkNotNullFromComponent()
79 return reference; in checkNotNullFromComponent()
83 * Ensures that an object reference passed as a parameter to the calling method is not null.
85 * @param reference an object reference
87 * message is formed by replacing the single {@code %s} placeholder in the template with
92 * @return the non-null reference that was validated
93 * @throws NullPointerException if {@code reference} is null
98 T reference, String errorMessageTemplate, Object errorMessageArg) { in checkNotNull() argument
99 if (reference == null) { in checkNotNull()
100 // Simple implementation of String.format, which is not GWT-compatible in checkNotNull()
114 return reference; in checkNotNull()
120 * @throws IllegalStateException if {@code requirement is null}