Skip to content

Commit a41f3d1

Browse files
committed
#9 Added @Important annotation.
1 parent c1bd67f commit a41f3d1

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.codestickers;
2+
3+
import java.lang.annotation.*;
4+
5+
/**
6+
* This annotation contains related information.
7+
*/
8+
@Retention(RetentionPolicy.CLASS)
9+
@Target({ElementType.TYPE,
10+
ElementType.FIELD,
11+
ElementType.METHOD,
12+
ElementType.PARAMETER,
13+
ElementType.CONSTRUCTOR,
14+
ElementType.LOCAL_VARIABLE,
15+
ElementType.ANNOTATION_TYPE,
16+
ElementType.PACKAGE,
17+
ElementType.TYPE_PARAMETER,
18+
ElementType.TYPE_USE})
19+
@Documented
20+
@Repeatable(Importants.class)
21+
public @interface Important {
22+
String value() default "";
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.codestickers;
2+
3+
import java.lang.annotation.*;
4+
5+
/**
6+
* A container for annotation repetition.
7+
*/
8+
@Retention(RetentionPolicy.CLASS)
9+
@Target({ElementType.TYPE,
10+
ElementType.FIELD,
11+
ElementType.METHOD,
12+
ElementType.PARAMETER,
13+
ElementType.CONSTRUCTOR,
14+
ElementType.LOCAL_VARIABLE,
15+
ElementType.ANNOTATION_TYPE,
16+
ElementType.PACKAGE,
17+
ElementType.TYPE_PARAMETER,
18+
ElementType.TYPE_USE})
19+
@Documented
20+
public @interface Importants
21+
{
22+
Important[] value();
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.github.codestickers;
2+
3+
public class ImportantTest {
4+
5+
@Important("first one")
6+
@Important("duplicate")
7+
public static class SomeClass {
8+
@Important("check if really required")
9+
public SomeClass() {
10+
}
11+
12+
public @Important("dont know how") Void m(@Important long param) {
13+
return null;
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)