Extremely fast, lightweight annotation scanner for the classpath, classloader, or files for Java 6+
Go to file
Robinson e7e2594031
updated build deps
2023-11-27 17:14:37 +01:00
gradle/wrapper updated gradle 2023-10-02 16:12:50 +02:00
src/dorkbox/annotation Added updates, updated version, updated build deps 2023-01-16 23:15:05 +01:00
src9 Added updates, updated version, updated build deps 2023-01-16 23:15:05 +01:00
.gitignore updated .gitignore 2019-05-13 15:16:25 +02:00
LICENSE Updated build deps, license 2023-01-17 01:57:24 +01:00
LICENSE.Apachev2 Initial import of annotations project 2015-02-02 12:54:51 +01:00
README.md Added updates, updated version, updated build deps 2023-01-16 23:15:05 +01:00
build.gradle.kts updated build deps 2023-11-27 17:14:37 +01:00
gradle.properties Updated build deps 2023-10-09 12:25:02 +02:00
gradlew updated gradle 2022-03-07 22:26:53 +01:00
gradlew.bat updated gradle 2022-03-07 22:26:53 +01:00
settings.gradle.kts Hardcoded project name 2023-08-05 12:26:33 -06:00



Dorkbox Github Gitlab

The Annotations project is based on, and almost identical to the excellent infomas AnnotationDetector.

There are major changes to the API to provide for a way to easily extend the scanning functionality, hence it lives here on it's own.

This library can be used to scan (part of) the class path for annotated classes, methods or instance variables. Main advantages of this library compared with similar solutions are: light weight (simple API, 20 kb jar file) and very fast (fastest annotation detection library as far as I know).

The main features of this annotations scanning library:

  • scans the bytecode for annotation information, meaning classes do not have to be loaded by the JVM

  • small footprint

  • extremely fast performance (on moderate hardware, about 200 MB/s)!

  • can scan the classpath, classloader, or specified location

  • uses the SLF4j logging interface

  • simple builder style API

  • lightweight

  • This is for cross-platform use, specifically - linux 32/64, mac 32/64, and windows 32/64. Java 6+

try {
    // Get a list of all classes annotated with @Module, inside the "dorkbox.client" and "dorkbox.common" packages.
    List<Module> classModules = AnnotationDetector.scanClassPath("dorkbox.client", "dorkbox.common")
                                     .forAnnotations(Module.class)  // one or more annotations
                                     .on(ElementType.METHOD) // optional, default ElementType.TYPE. One ore more element types
                                     .filter((File dir, String name) -> !name.endsWith("Client.class")) // optional, default all *.class files
} catch (IOException e) {
    throw new IllegalArgumentException("Unable to start the client", e);


Maven Info


Gradle Info

dependencies {
    compile "com.dorkbox:Annotations:3.1"


This project is © 2014, XIAM Solutions B.V. (http://www.xiam.nl) and © 2020 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.