Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Aspect-Oriented Annotations

Aspect-Oriented Annotations Annotations are one of the new language features in J2SE 5.0, and allow you to attach metadata onto any Java construct. Meanwhile, Aspect-Oriented Programming (AOP) is a fairly new technology that makes it easier for you to en

Tutorial Details:

Annotation Overview
First let's give a brief overview of the two technologies. Annotations are new to JDK 5.0 and are defined in detail in the JSR-175 specification. They allow you to define metadata in a typesafe way and apply it to a class, method, constructor, field, or parameter. For those of you familiar with XDoclet, annotations will be very intuitive to you in that you are used to declaring tags to generate code. The main difference between the two is that annotations are a typed part of the Java language, while XDoclet tags can be mistyped and are harder to create. I like to work with examples, so let's show a simple one.
To define an annotation, all you need to do is declare a special kind of Java interface.
Orange.java
package org.jboss.colors;
public @interface Orange {}
After defining this interface, you can use it to give more description to your Java elements.
Foo.java
package org.jboss.examples;
public class Foo
{
@Orange void someMethod();
@Orange private int someField;
}
So what can use use annotations for? Some people envision using annotations for code generation and a replacement for XDoclet. Others, like the J2EE and EJB 3.0 expert groups, see it as a replacement for deployment descriptors. This article talks about how annotations can be used with AOP.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Aspect-Oriented Annotations

View Tutorial:
Aspect-Oriented Annotations

Related Tutorials:

I want my AOP!, Part 1
I want my AOP!, Part 1
 
I want my AOP!, Part 2
I want my AOP!, Part 2
 
I want my AOP!, Part 3
I want my AOP!, Part 3
 
Improve Application Management With JMX
Improve Application Management With JMX Leverage JMX technology and existing tools to boost the operations management capabilities of your business applications.
 
Object-relation mapping without the container
If you follow the latest developer buzz then you\\\\\'ve likely heard of IOC (Inversion of Control) containers and AOP (aspect-oriented programming).
 
Declarative Programming in Java
Declarative Programming in Java What makes EJB components special is the declarative programming model through which we can specify the services such as security, persistence, transaction etc., that the container should provide. An EJB only implements
 
Performance Analysis of J2EE Applications Using AOP Techniques
Performance Analysis of J2EE Applications Using AOP Techniques In this article we demonstrate the use of AOP techniques through which J2EE applications can be easily instrumented without any modifications to application code. We have developed a very sim
 
Attribute-Oriented Programming with Java 1.5, Part 1
In this article, I will consider the case of a status-bar component embedded in a GUI application. I will explore a number of different ways to implement this status reporter, starting with the traditional hard-coded idiom. Along the way, I will introduce
 
Second-generation aspect-oriented programming
Second-generation aspect-oriented programming
 
Attribute-Oriented Programming with Java 1.5, Part 2
Peeking Inside the Box: Attribute-Oriented Programming with Java 1.5,Part In the previous article in this series, "Peeking Inside the Box, Part 1," I introduced the concepts of Attribute-Oriented Programming, Java 1.5 annotations, and bytecode instrume
 
Taming Tiger, Part 3
J2SE 5—code named "Tiger"—is the most significant revision to the Java language since its original inception. Tarak Modi's primary goal with his three-part series on Tiger is to familiarize readers with J2SE 5's most important additions and show how t
 
G (2D graphic library)
G is a generic graphics library built on top of Java 2D in order to make scene graph oriented 2D graphics available to client applications in a high level, easy to use way
 
Aspect-Oriented Annotations
Aspect-Oriented Annotations Annotations are one of the new language features in J2SE 5.0, and allow you to attach metadata onto any Java construct. Meanwhile, Aspect-Oriented Programming (AOP) is a fairly new technology that makes it easier for you to en
 
Annotations in Tiger, Part 1: Add metadata to Java code
Annotations, a new feature in J2SE 5.0 (Tiger), brings a much-needed metadata facility to the core Java language. In this first of a two-part series, author Brett McLaughlin explains why metadata is so useful, introduces you to annotations in the Java lan
 
Annotations in Tiger, Part 2: Custom annotations
Write your own annotations in Java 5 Part 1 of this series introduced annotations, the new metadata facility in J2SE 5.0, and focused on Tiger's basic built-in annotations. A more powerful related feature is support for writing your own annotations. In t
 
Aspect-Oriented Programming in Java
This article is divided into three parts: The first part explaines the concepts of AOP, the second introduces AspectJ(TM), an implementation of the AOP concepts in Java, and part three compares the AOP approach to metalevel programming.
 
Develop aspect-oriented Java applications with Eclipse and AJDT
AspectJ is an aspect-oriented extension of the Javaâ„¢ language that enables a modular implementation of crosscutting concerns. This crosscutting behavior, which can be static or dynamic, presents an extra challenge to tools that support AspectJ. The AJDT
 
Bridging the Gap: J2SE 5.0 Annotations
Bridging the Gap: J2SE 5.0 Annotations It takes a long time for the Java community to fully absorb a major new JDK release; it seems to take about two more releases after a brand new version of the JDK before everything settles down. Application server v
 
Create and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit
Create and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit Bytecode Attributes Annotations are actually stored in bytecode with several special attributes. The binary format for these and all other standard attributes is described in the Java Vi
 
The On Demand Operating Environment
The On Demand Operating Environment is based upon the concepts of Service Oriented Architecture (SOA). SOA views every application or resource as a service implementing a specific, identifiable set of (business) functions. In addition to the business...
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.