Example usage for java.lang NullPointerException NullPointerException

List of usage examples for java.lang NullPointerException NullPointerException

Introduction

In this page you can find the example usage for java.lang NullPointerException NullPointerException.

Prototype

public NullPointerException(String s) 

Source Link

Document

Constructs a NullPointerException with the specified detail message.

Usage

From source file:Main.java

static <T> T checkNotNull(T paramT, String paramString) {
    if (paramT == null)
        throw new NullPointerException(paramString);
    return paramT;
}

From source file:Main.java

public static <T> T checkNotNull(T reference, String err) {
    if (reference == null) {
        throw new NullPointerException(err);
    }//from  w  ww  .  j av a 2 s  . c om
    return reference;
}

From source file:Main.java

public static void checkNotNull(Object object, String message) {
    if (object == null) {
        throw new NullPointerException(message);
    }//from w ww.j  ava2  s  . c o  m
}

From source file:Main.java

public static void checkNotNull(Object argument, String msg) {
    if (argument == null) {
        throw new NullPointerException(msg);
    }/*from   w w  w . java 2s .  c om*/
}

From source file:Main.java

public static <T> T checkNotNull(T value, String message) {
    if (value == null) {
        throw new NullPointerException(message);
    }/*from  w  ww. ja  va  2  s.  c  o m*/
    return value;
}

From source file:Main.java

public static <T> T checkNotNull(T reference, Object errorMessage) {
    if (reference == null) {
        throw new NullPointerException(String.valueOf(errorMessage));
    } else {//w  w w.  j  av a  2 s . co  m
        return reference;
    }
}

From source file:Main.java

public static Font createBoldFont(Font font) {
    if (font == null) {
        throw new NullPointerException("font == null");
    }/*from  w w  w  . jav  a 2 s . co  m*/
    String fontName = font.getName();
    int fontSize = font.getSize();
    return new Font(fontName, Font.BOLD, fontSize);
}

From source file:Main.java

public static void checkNotNull(Object target, String msg) {
    if (target == null)
        throw new NullPointerException(msg);
}

From source file:Main.java

public static void checkNonNull(Object obj, String msg) {
    if (obj == null)
        throw new NullPointerException(msg);
}

From source file:Main.java

public static <T> T notNull(final T object, final String message, final Object... values) {
    if (object == null) {
        throw new NullPointerException(String.format(message, values));
    }// www  .ja v a2s  .c om
    return object;
}