GithubHelp home page GithubHelp logo

nztomas / annotations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dorkbox/annotations

0.0 0.0 0.0 212 KB

Extremely fast and lightweight annotation scanner for the classpath, classloader, or files for Java 6+

License: Other

Kotlin 5.59% Java 94.41%

annotations's Introduction

Annotations

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
                                     .collect(AnnotationDefaults.getType);
} catch (IOException e) {
    throw new IllegalArgumentException("Unable to start the client", e);
}

   

Maven Info

<dependencies>
    ...
    <dependency>
      <groupId>com.dorkbox</groupId>
      <artifactId>Annotations</artifactId>
      <version>3.1</version>
    </dependency>
</dependencies>

Gradle Info

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

License

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.

annotations's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.