com.remondis.remap.Lang Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of remap Show documentation
Show all versions of remap Show documentation
A declarative mapping library for converting objects field by field.
package com.remondis.remap;
/**
* A utility class to provide some language features.
*
* @author schuettec
*/
class Lang {
/**
* This method throws an {@link IllegalArgumentException} if the specified argument is null.
*
* @param fieldName The parameter name.
* @param argument The actual argument.
* @return Returns the argument
* @throws IllegalArgumentException Thrown with a detailed message if argument is null
. Returns
* immediately otherwise.
*/
static T denyNull(String fieldName, T argument) throws IllegalArgumentException {
if (argument == null) {
if (fieldName == null) {
throw new IllegalArgumentException("Argument may not be null.");
} else {
throw new IllegalArgumentException(String.format("Argument %s may not be null.", fieldName));
}
}
return argument;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy