Home / Class/ ObjectUtil Class — netty Architecture

ObjectUtil Class — netty Architecture

Architecture documentation for the ObjectUtil class in ObjectUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  13c1c162_0c7f_9250_1333_d3520660541f["ObjectUtil"]
  02fcdacd_7aa6_ecda_1deb_f7a8a2b34f1c["ObjectUtil.java"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|defined in| 02fcdacd_7aa6_ecda_1deb_f7a8a2b34f1c
  83e6ef39_466c_75f2_c3d6_066645d2b5e5["ObjectUtil()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 83e6ef39_466c_75f2_c3d6_066645d2b5e5
  8d6a9c8d_34e1_3027_7b3d_d759daa01151["T()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 8d6a9c8d_34e1_3027_7b3d_d759daa01151
  730a5543_ba74_a11d_7831_a5ee1a560fed["deepCheckNotNull()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 730a5543_ba74_a11d_7831_a5ee1a560fed
  71f9482a_9339_9679_7a3e_16734668f37d["checkPositive()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 71f9482a_9339_9679_7a3e_16734668f37d
  70b5b80d_9997_20ab_52d7_92c58a892041["checkPositiveOrZero()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 70b5b80d_9997_20ab_52d7_92c58a892041
  af1514c9_8e7a_ce2e_204a_cc0a9f3fab92["checkInRange()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| af1514c9_8e7a_ce2e_204a_cc0a9f3fab92
  d752cc30_8bab_31ab_8b7a_24851ce21ff5["checkNonEmpty()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| d752cc30_8bab_31ab_8b7a_24851ce21ff5
  84876200_d933_9aac_911b_3a71dfd0f9ba["String()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 84876200_d933_9aac_911b_3a71dfd0f9ba
  b6878cc9_1a45_8233_ed7b_6f44fbb36a15["CharSequence()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| b6878cc9_1a45_8233_ed7b_6f44fbb36a15
  e083930a_a019_7ea2_7d30_f7ee5bebcd3a["intValue()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| e083930a_a019_7ea2_7d30_f7ee5bebcd3a
  900855b5_1f3d_bf3a_98dd_21460eb18f29["longValue()"]
  13c1c162_0c7f_9250_1333_d3520660541f -->|method| 900855b5_1f3d_bf3a_98dd_21460eb18f29

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/ObjectUtil.java lines 23–350

public final class ObjectUtil {

    private static final float FLOAT_ZERO = 0.0F;
    private static final double DOUBLE_ZERO = 0.0D;
    private static final long LONG_ZERO = 0L;
    private static final int INT_ZERO = 0;
    private static final short SHORT_ZERO = 0;

    private ObjectUtil() {
    }

    /**
     * Checks that the given argument is not null. If it is, throws {@link NullPointerException}.
     * Otherwise, returns the argument.
     */
    public static <T> T checkNotNull(T arg, String text) {
        if (arg == null) {
            throw new NullPointerException(text);
        }
        return arg;
    }

    /**
     * Check that the given varargs is not null and does not contain elements
     * null elements.
     *
     * If it is, throws {@link NullPointerException}.
     * Otherwise, returns the argument.
     */
    public static <T> T[] deepCheckNotNull(String text, T... varargs) {
        if (varargs == null) {
            throw new NullPointerException(text);
        }

        for (T element : varargs) {
            if (element == null) {
                throw new NullPointerException(text);
            }
        }
        return varargs;
    }

    /**
     * Checks that the given argument is not null. If it is, throws {@link IllegalArgumentException}.
     * Otherwise, returns the argument.
     */
    public static <T> T checkNotNullWithIAE(final T arg, final String paramName) throws IllegalArgumentException {
        if (arg == null) {
            throw new IllegalArgumentException("Param '" + paramName + "' must not be null");
        }
        return arg;
    }

    /**
     * Checks that the given argument is not null. If it is, throws {@link IllegalArgumentException}.
     * Otherwise, returns the argument.
     *
     * @param <T> type of the given argument value.
     * @param name of the parameter, belongs to the exception message.
     * @param index of the array, belongs to the exception message.
     * @param value to check.
     * @return the given argument value.
     * @throws IllegalArgumentException if value is null.
     */
    public static <T> T checkNotNullArrayParam(T value, int index, String name) throws IllegalArgumentException {
        if (value == null) {
            throw new IllegalArgumentException(
                    "Array index " + index + " of parameter '" + name + "' must not be null");
        }
        return value;
    }

    /**
     * Checks that the given argument is strictly positive. If it is not, throws {@link IllegalArgumentException}.
     * Otherwise, returns the argument.
     */
    public static int checkPositive(int i, String name) {
        if (i <= INT_ZERO) {
            throw new IllegalArgumentException(name + " : " + i + " (expected: > 0)");
        }
        return i;

Frequently Asked Questions

What is the ObjectUtil class?
ObjectUtil is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/ObjectUtil.java.
Where is ObjectUtil defined?
ObjectUtil is defined in common/src/main/java/io/netty/util/internal/ObjectUtil.java at line 23.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free