Total WebSite Views Count

Repeating Annotations Java * Feature

As the name suggests, Repeating Annotations imply that a particular annotation is applied multiple times to a declaration.


In Java 8 release, Java allows you to repeating annotations in your source code. It is helpful when you want to reuse annotation for the same class. You can repeat an annotation anywhere that you would use a standard annotation.



@Repeatable(Colors.class)

@interface Color {
String name();
@Retention(RetentionPolicy.RUNTIME)
}
Color[] value();
@interface Colors { }
@Color(name = "red")
@Color(name = "blue")
@Color(name = "green")
class Shirt {
}

public class RepeatingAnnotations {
public static void main(String args[]) {
Color[] colorArray = Shirt.class.getAnnotationsByType(Color.class);
for (Color color : colorArray) {
System.out.println(color.name());
} }
}

AWS Services

AWS Services

Technology Selection & Evaluation Criteria

Technology Selection & Evaluation Criteria

Scale Cube - Scale In X Y Z Cube

Scale Cube - Scale In X Y Z Cube

Feature Post

AWS Services

About Me

About Me

Spring Cloud

Spring Cloud
Spring Cloud

Spring Cloud +mCloud Native + Big Data Archittect

Spring Cloud +mCloud Native + Big Data Archittect

ACID Transaction

ACID Transaction

Data Pipe Line Stack

Data Pipe Line Stack

Popular Posts