Java Reference
In-Depth Information
the major and minor revision, you could define the following annotation
type that has a default revision number of 1.0:
@interface Revision {
int major() default 1;
int minor() default 0;
}
The values themselves must be constant expressions or literals (such as
a class literal), but not null .
The Revision annotation type could be used to annotate a class or in-
terfacewe show you how to enforce this a little lateror used by other
annotation types. In particular we can redefine the ClassInfo annotation
type to use it:
@interface ClassInfo {
String created();
String createdBy();
String lastModified();
String lastModifiedBy();
Revision revision();
}
When we first created class Foo we might have used ClassInfo :
@ClassInfo (
created = "Jan 31 2005",
createdBy = "James Gosling",
lastModified = "Jan 31 2005",
lastModifiedBy = "James Gosling",
revision = @Revision
)
public class Foo {
 
Search WWH ::




Custom Search