Skip to content

Instantly share code, notes, and snippets.

@h1ddengames
Last active March 27, 2022 01:00
Show Gist options
  • Save h1ddengames/e9453ceeb118b47ebe17b588d28d0226 to your computer and use it in GitHub Desktop.
Save h1ddengames/e9453ceeb118b47ebe17b588d28d0226 to your computer and use it in GitHub Desktop.
Java File and Code Templates for IntelliJ
/**
* Purpose: What does this class do?
*
* @version 1.0
* @since ${DATE} - ${TIME}
* @author Shahid Karim
*/
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
// ~@Variables
// ~@Constructors
// ~@Getters/Setters
// ~@Methods
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import java.util.Arrays;
import java.util.Optional;
#parse("File Header.java")
public enum ${NAME} {
TYPE("T");
private final String value;
${NAME}(String value) {
this.value = value;
}
public static Optional<${NAME}> convertToEnum(String value) {
return Arrays.stream(${NAME}.values())
.filter(currentEnumElement -> currentEnumElement.value.equals(value))
.findFirst();
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
#parse("File Header.java")
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ${NAME} {
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import org.junit.jupiter.api.Test;
#parse("File Header.java")
public class ${NAME} {
@Test
public void test() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment