Commit | Line | Data |
---|---|---|
6e9d7383 | 1 | import java.util.LinkedList; |
6e9d7383 | 2 | import java.lang.annotation.Annotation; |
3b196926 JB |
3 | import java.util.Date; |
4 | import java.text.SimpleDateFormat; | |
5 | import java.text.ParseException; | |
b2186d16 JB |
6 | |
7 | class Main { | |
8 | ||
9 | /** | |
10 | * The main() function | |
11 | * @param String[] args main() function arguments array | |
12 | */ | |
13 | public static void main(String[] args) { | |
6e9d7383 JB |
14 | //FIXME: one can create a smart way of building this list |
15 | LinkedList<Class<?>> packageClasses = new LinkedList<Class<?>>(); | |
3b196926 | 16 | packageClasses.add(Cercle.class); |
6e9d7383 JB |
17 | packageClasses.add(Entiers.class); |
18 | packageClasses.add(Forme.class); | |
19 | packageClasses.add(Image.class); | |
bb6a4f9a | 20 | packageClasses.add(Node.class); |
6e9d7383 JB |
21 | packageClasses.add(Liste.class); |
22 | packageClasses.add(Piletransformations.class); | |
23 | packageClasses.add(Point.class); | |
24 | packageClasses.add(Segment.class); | |
25 | packageClasses.add(Structure.class); | |
b2186d16 | 26 | |
3b196926 | 27 | System.out.println("Class list created after 2009:"); |
6e9d7383 JB |
28 | for (Class<?> cl : packageClasses) { |
29 | ClassPreamble classPreamble = cl.getAnnotation(ClassPreamble.class); | |
80eafbcb | 30 | if (classPreamble == null) { |
6e9d7383 JB |
31 | System.out.println("No annotation for " + cl.getName()); |
32 | continue; | |
80eafbcb | 33 | } |
3b196926 JB |
34 | try { |
35 | SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy"); | |
36 | Date date = sdf.parse(classPreamble.date()); | |
37 | Integer classYear = date.getYear() + 1900; | |
38 | if (classYear >= 2009) { | |
39 | System.out.println(" " + cl.getName() + " created year " + classYear + "."); | |
40 | } | |
41 | } | |
42 | catch (ParseException e) { | |
a1aa04de | 43 | e.printStackTrace(); |
3b196926 | 44 | } |
6e9d7383 | 45 | } |
b2186d16 JB |
46 | } |
47 | } |