Annotation « Core Library « Java Articles

Home
Java Articles
1.Build Deploy
2.Class
3.Core Library
4.Data Types
5.Database JDBC
6.Design
7.Development
8.File Input Output
9.Graphics Desktop
10.J2EE Enterprise
11.J2ME Wireless
12.JVM
13.Language
14.Library Product
15.Network
16.Security
17.SOA Web Services
18.Test
19.Web Development
20.XML
Java Articles » Core Library » Annotation 

1. Custom schema generation with Hibernate annotations    javaworld.com

For a Java developer, Hibernate 3 annotations offer a terrific way to model the domain layer. Without much effort, you can get Hibernate to generate your database schema automatically, dispensing entirely with SQL scripts. Back in the real world, however, you still need to account for the sometimes obscure naming conventions used by your database administrator. In this article, Java Power Tools author John Ferguson Smart shows you how to generate database schemas automatically with Hibernate while still making your DBA happy.

2. Annotations to the rescue    javaworld.com

This article shows you how to use annotations beyond simple markings for initialization control. It introduces a small API that you can use to develop your own "phaseable" annotations and gives you some inspiration concerning this new feature's possibilities.

3. Design an MVC framework using annotations    javaworld.com

As one of the new features provided with J2SE 5.0, annotations allow the developer to add metadata to classes, methods, fields, and other language components. Just like reflection, any application can then retrieve and use that metadata at runtime for whatever reason. Since J2SE 5.0 defines only how to write and read annotations, but not what to do with them (with the exception of the predefined ones, like @Override), the developer has endless possibilities in using them for many different jobs: documentation, object-relational mapping, code-generation, and so on. Annotations have become quite popular as most frameworks and libraries are being updated to support them. See Resources for more information on MVC and annotations.

4. An annotation-based persistence framework    javaworld.com

Interestingly, the writers of the JavaBeans spec understood just how problematic this getter/setter tagging mechanism is. (The main downside, discussed in earlier articles, is that the getter/setter methods expose too much information about the object's implementation, thereby making the underlying class much harder to maintain.) Consequently, the designers provided a more object-oriented solution in the BeanInfo and Customizer interfaces. User-provided implementations of these interfaces let you build a GUI without the getters and setters. Unfortunately, this overly complicated object-oriented approach was described poorly in the spec. The getter/setter approach was easy, and if you didn't understand the object-oriented-related maintenance issues, then the getter/setter approach seemed reasonable. Consequently, the BeanInfo/Customizer approach fell by the wayside and getter/setter strategies have been propagating like rabbits. The fact that you see the idiom everywhere doesn't make it good, however.

5. Bridging the Gap: J2SE 5.0 Annotations    onjava.com

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 vendors don't always fully support dot-zero releases right away; IDE, profiler, and other tool support can lag; many new bugs have to be fixed; and businesses are leery of building on anything so new. Those of us on MacOS X who have not snagged a beta DVD have to wait until Tiger comes out in the first half of 2005 to use Java 5.0. The latter obstacle got me interested in how to co-opt some J2SE 5.0 features earlier rather than later.

6. Aspect-Oriented Annotations    onjava.com

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 encapsulate behavior that is usually messier, harder, or impossible to do with regular object-oriented (OO) techniques. Together, they make a new powerful combination that gives framework developers a more expressive way of providing their APIs. This article dives into combining these technologies using the JBoss AOP framework in various coding examples to show how you can use this combination to actually extend the Java language.

7. The Open Road: javax.annotation    today.java.net

Editor's Note: Java SE 5's annotations were one of the most profound additions to the Java language, offering a means of providing metadata about your code to be processed by the compiler or tools, or even at runtime. While many external projects and products have adopted annotations quickly and enthusiastically, the JDK itself continues to make only minimal use of annotations, even in Java SE 6. However, as Elliotte Rusty Harold reports in this latest installment of The Open Road, that's about to change.

8. Try Declarative Programming with Annotations and Aspects    devx.com

This article does not provide an in-depth exploration of declarative programming, EJBs, aspects, or annotations. Instead it takes a looks at the inter-relatedness of these technologies and how to combine them in novel ways to simplify application development.

9. Learn to Use the New Annotation Feature of Java 5.0    devx.com

Annotations will also be used for compile-time checking such as to produce warnings and errors for different failure scenarios. An example of an annotation that is used at compile time is the new @Deprecated annotation, which acts the same as the old @deprecated JavaDoc tag. Of course, a compiler has to know how to interpret annotation data that is meant to produce compile-time warnings, so again, annotations that do things at compile time will likely be used frequently, but rarely written by average developers.

10. Classworking toolkit: Annotations with ASM    ibm.com

With J2SE 5.0, Sun has added a number of new features to the Java? platform. One of the most important new features is support for annotations. Annotations promise to be useful for associating many types of metadata with Java code and are already being used extensively to replace custom configuration files in new and updated JSRs for extensions to the Java platform. In this column, I'll show how you can use the ASM bytecode manipulation framework in combination with another new J2SE 5.0 feature -- the instrumentation package -- to transform classes as they're being loaded into the JVM as directed by annotations.

11. Classworking toolkit: Annotations vs. configuration files    ibm.com

In the last section, I gave an example of what I see as inappropriate use of annotations, where a separate configuration file would work just as well and be easier to understand. For an example of a case where a configuration file works better than annotations, I'll turn to the JiBX data binding framework -- my own pet classworking project.

12. An Introduction to Java Annotations    developer.com

Annotation-based development is certainly one of the latest Java development trends. Annotation-based development relieves Java developers from the pain of cumbersome configuration. Quoting from Sun's official site, "It (annotation-based development) lets us avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a declarative programming style where the programmer says what should be done and tools emit the code to do it." Simply speaking, annotation is a mechanism for associating a meta-tag with program elements and allowing the compiler or the VM to extract program behaviors from these annotated elements and generate interdependent codes when necessary. In the first part of this three-article series, I'll describe some basics of annotation, their benefits, as well as some example usages.

13. Make Your Code Work for You with Java Annotations    developer.com

Annotations are a familiar sight to any Java developer who has ever read the Java API docs. They are the text snippets preceded by an @ sign that have been appearing in JavaDoc comments since Java was introduced. They may seem like simple snippets of extra information, but there is much more to annotations than meets the eye. Here, you will learn how to use annotations at coding time, compile time, and run time to make the most of your development efforts.

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.