10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INTERFACES Predefined Annotation Types 9.6.1<br />

<strong>The</strong> following annotation type declaration provides default values for two of its four elements:<br />

// Annotation type declaration with defaults on some elements<br />

public @interface RequestForEnhancement {<br />

int id(); // No default - must be specified in<br />

// each annotation<br />

String synopsis(); // No default - must be specified in<br />

// each annotation<br />

String engineer() default "[unassigned]";<br />

String date() default "[unimplemented]";<br />

}<br />

<strong>The</strong> following annotation type declaration shows a Class annotation whose value is<br />

restricted by a bounded wildcard.<br />

// Annotation type declaration with bounded wildcard to<br />

// restrict Class annotation<br />

// <strong>The</strong> annotation type declaration below presumes the existence<br />

// of this interface, which describes a formatter for <strong>Java</strong><br />

// programming language source code<br />

public interface Formatter { ... }<br />

// Designates a formatter to pretty-print the annotated class.<br />

public @interface PrettyPrinter {<br />

Class

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!