diff options
author | Gary Gregory <garydgregory@gmail.com> | 2021-02-07 10:20:20 -0500 |
---|---|---|
committer | Gary Gregory <garydgregory@gmail.com> | 2021-02-07 10:20:20 -0500 |
commit | d52631700651ebc1ba3f96e92196e267e6d68fe6 (patch) | |
tree | 928a4b9f92e9db62c977004847cb5b3b75ce589e /src/main/java/org/apache/commons/lang3/function | |
parent | ac6ebf4e1c506deea6c2993e111d93f3cac65e44 (diff) | |
download | apache-commons-lang-d52631700651ebc1ba3f96e92196e267e6d68fe6.tar.gz |
Use the standard "T" generic type.
Diffstat (limited to 'src/main/java/org/apache/commons/lang3/function')
-rwxr-xr-x | src/main/java/org/apache/commons/lang3/function/Objects.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/org/apache/commons/lang3/function/Objects.java b/src/main/java/org/apache/commons/lang3/function/Objects.java index b2310f682..b42e65e32 100755 --- a/src/main/java/org/apache/commons/lang3/function/Objects.java +++ b/src/main/java/org/apache/commons/lang3/function/Objects.java @@ -63,13 +63,13 @@ public class Objects { /** * Checks, whether the given object is non-null. If so, returns the non-null * object as a result value. Otherwise, a NullPointerException is thrown. - * @param <O> The type of parameter {@code value}, also the result type. + * @param <T> The type of parameter {@code value}, also the result type. * @param value The value, which is being checked. * @return The given input value, if it was found to be non-null. * @throws NullPointerException The input value was null. * @see java.util.Objects#requireNonNull(Object) */ - public static <O> @Nonnull O requireNonNull(@Nullable O value) throws NullPointerException { + public static <T> @Nonnull T requireNonNull(@Nullable T value) throws NullPointerException { if (value == null) { throw new NullPointerException("The value must not be null."); } @@ -79,7 +79,7 @@ public class Objects { /** * Checks, whether the given object is non-null. If so, returns the non-null * object as a result value. Otherwise, a NullPointerException is thrown. - * @param <O> The type of parameter {@code value}, also the result type. + * @param <T> The type of parameter {@code value}, also the result type. * @param value The value, which is being checked. * @param defaultValue The default value, which is being returned, if the * check fails, and the {@code value} is null. @@ -87,7 +87,7 @@ public class Objects { * @return The given input value, if it was found to be non-null. * @see java.util.Objects#requireNonNull(Object) */ - public static <O> @Nonnull O requireNonNull(@Nullable O value, @Nonnull O defaultValue) { + public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull T defaultValue) { if (value == null) { if (defaultValue == null) { throw new NullPointerException("The default value must not be null."); @@ -100,7 +100,7 @@ public class Objects { /** * Checks, whether the given object is non-null. If so, returns the non-null * object as a result value. Otherwise, a NullPointerException is thrown. - * @param <O> The type of parameter {@code value}, also the result type. + * @param <T> The type of parameter {@code value}, also the result type. * @param value The value, which is being checked. * @param msg A string, which is being used as the exceptions message, if the * check fails. @@ -109,7 +109,7 @@ public class Objects { * @see java.util.Objects#requireNonNull(Object, String) * @see #requireNonNull(Object, Supplier) */ - public static <O> @Nonnull O requireNonNull(@Nullable O value, @Nonnull String msg) throws NullPointerException { + public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull String msg) throws NullPointerException { if (value == null) { throw new NullPointerException(msg); } @@ -119,7 +119,7 @@ public class Objects { /** * Checks, whether the given object is non-null. If so, returns the non-null * object as a result value. Otherwise, a NullPointerException is thrown. - * @param <O> The type of parameter {@code value}, also the result type. + * @param <T> The type of parameter {@code value}, also the result type. * @param value The value, which is being checked. * @param msgSupplier A supplier, which creates the exception message, if the check fails. * This supplier will only be invoked, if necessary. @@ -128,7 +128,7 @@ public class Objects { * @see java.util.Objects#requireNonNull(Object, String) * @see #requireNonNull(Object, String) */ - public static <O> @Nonnull O requireNonNull(@Nullable O value, @Nonnull Supplier<String> msgSupplier) throws NullPointerException { + public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull Supplier<String> msgSupplier) throws NullPointerException { if (value == null) { throw new NullPointerException(msgSupplier.get()); } @@ -138,7 +138,7 @@ public class Objects { /** Checks, whether the given object is non-null. If so, returns the non-null * object as a result value. Otherwise, invokes the given {@link Supplier}, * and returns the suppliers result value. - * @param <O> The type of parameter {@code value}, also the result type of + * @param <T> The type of parameter {@code value}, also the result type of * the default value supplier, and of the method itself. * @param <E> The type of exception, that the {@code default value supplier}, * may throw. @@ -154,10 +154,10 @@ public class Objects { * @throws NullPointerException The default value supplier is null, or the default * value supplier has returned null. */ - public static <O, E extends Throwable> @Nonnull O requireNonNull(@Nullable O value, @Nonnull FailableSupplier<O, E> defaultValueSupplier) { + public static <T, E extends Throwable> @Nonnull T requireNonNull(@Nullable T value, @Nonnull FailableSupplier<T, E> defaultValueSupplier) { if (value == null) { - final FailableSupplier<O, ?> supp = requireNonNull(defaultValueSupplier, "The supplier must not be null"); - final O o; + final FailableSupplier<T, ?> supp = requireNonNull(defaultValueSupplier, "The supplier must not be null"); + final T o; try { o = supp.get(); } catch (Throwable t) { |