Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30261

annotation metadata proposal

Newsgroups comp.lang.java.programmer
Date 2014-10-30 21:06 -0700
Message-ID <16dee62b-b502-470b-b99b-456dced35684@googlegroups.com> (permalink)
Subject annotation metadata proposal
From boxzou@gmail.com

Show all headers | View raw


1. Problem:
Suppose I wrote 2 classes summer.sports.Soccer and winter.sports.Hockey each in their own jar (soccer.jar and hockey.jar).  Each class is annotation @Sport.  Now at runtime, I want to find all classes annotated with @Sport.

Scanning all jars is kinda expensive.

The alternative is to have a properties file where you can list all such classes or better yet packages that contain those classes.  Each jar file would have such a properties file.

But it is tedious to maintain such list.

Note I allow new sports jar added, I can not specify the packages using something like Spring framework's component:scan(packages) because I can not predict future.

I think tools can help.

2. Proposal:
    a) add an file in jar: META-INF/annotated-classes
    b) format: full.class.name:Ann1,Ann2, one class per line
    c) mvn plugin to generate META-INF/annotated-classes and package it in jar/war
    d) IDE: when building a project generate such entry and put in output folder (e.g. target/classes)
    e) provide library to read all META-INF/annotated-classes

What do you think?

Thanks.

Bo

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

annotation metadata proposal boxzou@gmail.com - 2014-10-30 21:06 -0700
  Re: annotation metadata proposal Joerg Meier <joergmmeier@arcor.de> - 2014-10-31 07:46 +0100
  Re: annotation metadata proposal Arne Vajhøj <arne@vajhoej.dk> - 2014-10-31 20:53 -0400
    Re: annotation metadata proposal boxzou@gmail.com - 2014-10-31 20:26 -0700
  Re: annotation metadata proposal Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-11-01 00:33 -0400
    Re: annotation metadata proposal boxzou@gmail.com - 2014-11-01 07:50 -0700
      Re: annotation metadata proposal Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-01 20:42 +0000
        Re: annotation metadata proposal boxzou@gmail.com - 2014-11-01 15:56 -0700
          Re: annotation metadata proposal Robert Klemme <shortcutter@googlemail.com> - 2014-11-02 00:08 +0100
            Re: annotation metadata proposal boxzou@gmail.com - 2014-11-01 19:38 -0700
              Re: annotation metadata proposal boxzou@gmail.com - 2014-11-04 21:46 -0800
                Re: annotation metadata proposal boxzou@gmail.com - 2014-11-04 21:50 -0800
          Re: annotation metadata proposal Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-02 00:31 +0000

csiph-web