Wednesday 25 June 2014

Multi-element Annotation type

An Annotation type with more than one element is called Multi-Element Annotation type.

public @interface AuthorDetails{
 String author();
 String date();
 int currentVersion() default 1;
 String lastModified() default "N/A";
 String[] Reviewers();
}

1. An annotation type declaration contains an element whose type is also an annotation type.

@interface BookPublisher{
 String value();
} 

public @interface Sample{
 BookPublisher name();
}

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment