Java News from Thursday, November 3, 2005

Sun's posted the proposed final draft of JSR-250 Common Annotations for the Java™ Platform. Proposed annotations include:

javax.annotation.Generated
automatically generated code that has not been written by a human being; e.g. the GUI code generated by NetBeans
javax.annotation.Resource
"used to declare a reference to a resource. It can be specified on a class, methods or on fields. When the annotation is applied on a field or method, the container will inject an instance of the requested resource into the application when the application is initialized. If the annotation is applied to a class, the annotation declares a resource that the application will look up at runtime."
javax.annotation.Resources
"Since repeated annotations are not allowed, the Resources annotation acts as a container for multiple resource declarations."
javax.annotation.PostConstruct
"a method that needs to be executed after dependency injection is done to perform any initialization."
javax.annotation.PreDestroy
"used on methods as a callback notification to signal that the instance is in the process of being removed by the container. The method annotated with PreDestroy is typically used to release resources that it has been holding."
javax.annotation.security.RunAs
"defines the role of the application during execution in a Java EE container. It can be specified on a class. This allows developers to execute an application under a particular role."
javax.annotation.security.RolesAllowed
"specifies the security roles permitted to access method(s) in an application."
javax.annotation.security.PermitAll
"specifies that all security roles are allowed to invoke the specified method(s), that is, that the specified method(s) are “unchecked”. It can be specified on a class or on methods. Specifying it on the class means that it applies to all methods of the class. If specified at the method level, it only affects that method."
javax.annotation.security.DenyAll
"specifies that no security roles are allowed to invoke the specified method(s), that is, that the method(s) are to be excluded from execution in the Java EE container."

Java 1.5 or later will be required for this to work.