annotations

Annotating YouTube videos programatically

I want to be able to display a normal youtube video with overlaid annotations. This consists of colored rectangles for each frame. The only requirement is that this be done programatically. Youtube has annotations now, but require you use their front end to create them by hand. I want to be able to generate them. What's the best way of d...

Java Annotations

What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they effect the running of a program?? What are typical usages for them? Also, are they unique to Java, is there a C++ equivalent? ...

Is it worth the effort to move from a hand crafted hibernate mapping file to annotaions?

I've got a webapp whose original code base was developed with a hand crafted hibernate mapping file. Since then, I've become fairly proficient at 'coding' my hbm.xml file. But all the cool kids are using annotations these days. So, the question is: Is it worth the effort to refactor my code to use hibernate annotations? Will I gain a...

When do you use Java's @Override annotation and why?

What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override? ...

How do I force a Java subclass to define an Annotation?

If a class defined an annotation, is it somehow possible to force its subclass to define the same annotation? For instance, we have a simple class/subclass pair that share the @Author @interface. What I'd like to do is force each further subclass to define the same @Author annotation, preventing a RuntimeException somewhere down the roa...

What is effect of "__callback" SAL annotation?

While I certainly understand the purpose of buffer annotations, I can't see what kind of errors __callback detects. Any ideas, examples? ...

Java annotations for design patterns?

Is there a project that maintains annotations for patterns? For example, when I write a builder, I want to mark it with @Builder. Annotating in this way immediately provides a clear idea of what the code implements. Also, the Javadoc of the @Builder annotation can reference explanations of the builder pattern. Furthermore, navigating f...

How can I get access to the HttpServletRequest object when using Java Web Services

I'm using Java 6, Tomcat 6, and Metro. I use WebService and WebMethod annotations to expose my web service. I would like to obtain information about the request. I tried the following code, but wsCtxt is always null. What step must I take to not get null for the WebServiceContext. In other words: how can I execute the following line to ...

Another JPA Question

I have this code: @PersistenceContext(name="persistence/monkey", unitName="deltaflow-pu") ... @Stateless public class GahBean implements GahRemote { But when I use this: try{ InitialContext ic = new InitialContext(); System.out.println("Pissing me off * " + ic.lookup("java:comp/env/persistent/monkey")); Iterator e = ic.getEnvironm...

When Using Dynamic Proxies, how do I access the underlying object's Annotations?

When Using Dynamic Proxies, how do I access the underlying object's Annotations? Specifically I'm annotating settings of a ORM object with @Column("client_id") and then making a Dynamic Proxy keep track of when the annotated setters are called, but... It doesn't seem that the annotated proxy keeps any of the underlying annotations so s...

Annotations on Interfaces?

I can't for the life of me figure out a use case for being able to annotate interfaces in Java. Maybe someone smarter than I am could give me an example? ...

Struts2 Annotation-Validators for Invalid Chars

Heyall, While using Struts2, I am using several annotations to do my validations inside the Model class, in the set() methods, like: @RequiredStringValidator(message = "Name is required") @StringLengthFieldValidator(message = "Name must be between 5 and 60 characters", minLength = "5", maxLength = "60") p...

Annotated Spring-MVC controller not recognized when controller extends interface

I'm using spring 2.5, and am using annotations to configure my controllers. My controller works fine if I do not implement any additional interfaces, but the spring container doesn't recognize the controller/request mapping when I add interface implementations. I can't figure out why adding an interface implementation messes up the con...

Spring-MVC Problem using @Controller on controller implementing an interface

I'm using spring 2.5 and annotations to configure my spring-mvc web context. Unfortunately, I am unable to get the following to work. I'm not sure if this is a bug (seems like it) or if there is a basic misunderstanding on how the annotations and interface implementation subclassing works. For example, @Controller @RequestMapping("ur...

Generic, annotation-driven event notification frameworks

While simple, interface-driven event notification frameworks in Java have been around since pre-Cambrian times (e.g. java.beans.PropertyChangeSupport), it is becoming increasingly popular for frameworks to use annotation-driven event notification instead. For an example, see JBossCache 2.2. The listener class has its listener methods ...

Xml configuration versus Annotation based configuration

In a few large projects i have been working on lately it seems to become increasingly important to choose one or the other (XML or Annotation). As projects grow, consistency is very important for maintainability. My question is, what do people prefer. Do you prefer XML based or Annotation based? or Both? Everybody talks about XML conf...

Setting default values for columns in JPA

Is it possible to set a default value for columns in JPA, and if, how is it done using annotations? ...

How do I make vim indent java annotations correctly?

When indenting java code with annotations, vim insists on indenting like this: @Test public void ... I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not sure if I can use that together with regular cindent...

Which anotation should I use: @IdClass or @EmbeddedId

The JPA (Java Persistence API) specification has 2 different ways to specify entity composite keys: @IdClass and @EmbeddedId. I'm using both annotations on my mapped entities, but it turns out to be a big mess to people who aren't very familiar with JPA. I want to adopt only one way to specify composite keys. Which one is really the ...

Should a method that implements an interface method be annotated with @Override

Intro My real question is about the use of the annotation. Trying to find an answer myself, I ran into several other questions. This is why there are also related questions below. I hope this is not too confusing. Question Should a method that implements an interface method be annotated with @Override? Eclipse for instance automatical...