I recently started to use lombok
in my project. In lombok documentation, it is specified that @NonNull
annotation can be configured to throw either NullPointerException
or IllegalArgumentException
. It is specified that by default NullPointerException
will be thrown. It is also specified that to throw IllegalArgumentException
, I should set lombok.nonNull.exceptionType = IllegalArgumentException
. But, I am not understanding where I should specify lombok.nonNull.exceptionType = IllegalArgumentException
in my code.
`
import com.sandesha.lombak.domain.Employee;
import lombok.NonNull;
public class EmployeeOperation {
/**
* @NonNull performs null check
* @param e1
* @param e2
* @return
*/
public boolean isEqual(@NonNull Employee e1, @NonNull Employee e2)
{
return e1.equals(e2);
}
}
Please help me. Thank you.
You need to create a file named lombok.config
in the home directory of your project, which is the default lombok configuration file to your project. The file looks like:
lombok.nonNull.exceptionType = IllegalArgumentException
lombok.nonNull.flagUsage = [warning | error]
You may see the project