public static < T > T assertNotNull ( T object , String fieldName ) throws IllegalArgumentException { if ( object == null ) { throw new IllegalArgumentException ( String . format ( "%s cannot be null" , fieldName ) ) ; } return object ; }
Asserts that the given object is non - null and returns it .