Set<JClassType> eventTypes = new HashSet<JClassType>();
TypeOracle typeOracle = context.getTypeOracle();
JClassType type = typeOracle.findType(typeName);
if (type.isAnnotationPresent(EventPackages.class)) {
JClassType eventType = typeOracle.findType(ApplicationEvent.class.getName());
EventPackages eventPackages = type.getAnnotation(EventPackages.class);
String[] patterns = eventPackages.value();
for (JPackage pkg : typeOracle.getPackages()) {
for (String pattern : patterns) {
if (pkg.getName().matches(pattern)) {
addEventTypes(pkg, eventTypes, eventType);
}