Java annotation processor that automatically generates utility methods for enum types.
- Automatically generates
is*methods for enum constants - Customizable method prefix
- Zero runtime dependencies
- Java 17+ support
Add the dependency to your project:
<dependency>
<groupId>io.github.altyndev</groupId>
<artifactId>dynamic-enum-processor</artifactId>
<version>1.0.0</version>
</dependency>Annotate your enum:
@DynamicEnum
public enum Role {
ADMIN,
USER,
GUEST
}The processor will generate a utility class:
public class RoleMethods {
public static boolean isAdmin(Role value) {
return value == Role.ADMIN;
}
public static boolean isUser(Role value) {
return value == Role.USER;
}
public static boolean isGuest(Role value) {
return value == Role.GUEST;
}
}You can customize the method prefix:
@DynamicEnum(methodPrefix = "has")
public enum Permission {
READ,
WRITE,
EXECUTE
}mvn clean install- Create a Sonatype OSSRH account
- Set up GPG key
- Configure Maven settings.xml
- Run:
mvn clean deployMIT License