- Download Gist
- Open Eclipse Preferences
- Go to Java/Editor/templates
- Click Import
Last active
January 24, 2019 09:45
-
-
Save bsorrentino/c736c2659f4a19dcdc48 to your computer and use it in GitHub Desktop.
Eclipse template (code snippet ) to check the argument and eventually throws IllegalArgumentException
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!-- JAVA8 SNIPPET --> | |
<templates> | |
<template autoinsert="true" context="java" deleted="false" description="check argument for null" enabled="true" name="notnull"> | |
Objects.requireNonNull( ${name:var}, "${name} is null!" ); | |
</template> | |
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!-- JAVA7 SNIPPET --> | |
<templates> | |
<template autoinsert="true" context="java" deleted="false" description="check argument for null" enabled="true" name="nullp"> | |
if( ${name:var} == null ) throw new java.lang.IllegalArgumentException( "${name} is null!"); | |
</template> | |
</templates> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment