public @interface Entity {
String tableName();
}
public @interface Column {
String name();
String type();
}
public @interface Id {
}
public class EntityProcessor extends AbstractAnnotationProcessor {
@Override
public void processClass(Class<?> clazz) {
Entity entityAnnotation = clazz.getAnnotation(Entity.class);
if (entityAnnotation != null) {
String tableName = entityAnnotation.tableName();
}
}
@Override
public void processField(Field field) {
Column columnAnnotation = field.getAnnotation(Column.class);
Id idAnnotation = field.getAnnotation(Id.class);
if (columnAnnotation != null) {
String columnName = columnAnnotation.name();
String columnType = columnAnnotation.type();
}
if (idAnnotation != null) {
}
}
}
alchamy.annotations.processors = com.example.EntityProcessor
[1] Alchamy Annotations Documentation. https://alchamy-annotations.com/documentation