annotations

Good example code for usage of javax.lang.model.element API?

I'm working on a Java Annotation Processor and have problems to understand how to use the API in practice. I have many different annotations and like to emit errors (and create code) depending on the parameters of the annotations. What open source projects are out there that use "javax.lang.model.element" and can serve as an example of ...

Is it possible to reuse the pre-defined controllers in spring annotation configured mvc projects?

Is it possible to reuse the predefined controllers, like the SimpleFormController, with annotation configured spring mvc projects? I downloaded a project that looks like what I want; however, the writer did not use the annotations that are predefined in Spring. The controller of the downloaded project: package net.sourceforge.sannotat...

debugging hibernate annotations, can you output the hbm file?

Is it possible to output the resulting hbm file for a class if you are trying to debug a problem? Are there any tools that can take a hbm and convert it to annotations? or visa versa ...

Spring Annotations not working

I posted this to the spring forums, sorry for the xpost. I am new to spring. I am working on an existing project that uses spring 1.2.8 (old, I know), and java 1.5 so annotations should work. I am trying to use the @Transactional annotation on a concrete class, following the docs at: http://static.springsource.org/spring/docs/1.2.8/ref...

Uncenter MkMapView

I am trying to "uncenter" the map view and remove all annotations. the reason for this is that the mapView will be used by different view controllers to display different annotations and locations. What's happening now is that i am using the "remove annotations" method and i removes them, but the map stays centered on the spot and thus w...

In MVC 2, how to annotate a class for an UI Helper Template (not a property)?

I know this works for single properties as per Scott Guthrie's blog to auto-magically use a partial view to render a partial model passed to it (UI Helper like in dynamic data): [UIHint("StateDropDown")] public string State { get; set;} But how do you annotate an entire class to use an UI helper like this: [UIHint("Address")] public ...

Hibernate creates two primary keys when I only want one...

I have a Hibernate class called Expression (simplified here for your viewing pleasure): @Entity public class Expression { @Id @GeneratedValue private long id; private String data; @OneToMany(fetch=FetchType.EAGER) @Cascade({CascadeType.MERGE, CascadeType.PERSIST}) private Set<Expression> dependencies; } T...

Why won't @override work??

What is wrong with piece of code? @Override protected void onCreate(Bundle savedInstanceState) { Eclipse states that @override cant be where it is. It says that 'Bundle' is wrong. I am lost. ...

annotation = comment?

do they by annotation mean a comment in a code with // or /* */? ...

Add Java Annotation to inherited field

I'm working on something that might benefit from a pattern like the following: public abstract class SomeBuisnessThingy() { protected int someDatapoint; } public class ADatabaseThingy() extends SomeBusinessThingy() { @SomeJPAAnnotation ???? someDatapoint; } public class AWebServiceThingy() extends SomeBusinessThingy() { @SomeS...

user location Blue marble drop

Does anyone know what triggers the blue marble animation. I know that it happens when the location gets updated but how do i trigger that event with whatever is in that property. I have an app that i would like to show the user's location when the map appears, but then clear the map of all annotations (including the user location)when th...

iPhone Map Kit cluster pinpoints

Regarding iPhone Map Kit cluster pinpoints: I have 1000's of marks that I want to show on the map but it's just too many to handle so I want to cluster them. Are there frameworks available or proof of concepts? That this is possible or is already been done? ...

If an annotation is associated with a method while declaring it in an interface, can we force the presence of annotation in the implementation class?

This is regarding use of annotations in Java. I associated an annotation with a method while declaring it in the interface. While implementing, how can I ensure that the annotation is carried along with @Override annotation and if not, it should throw a compilation error? Thanks. ...

how do java annotations work with spring, are they scanned at runtime or at startup?

Just trying to understand how Java annotations work under the covers. Seeing as spring relies on annotations and scanning the object graph for DI and AOP (reflection), curious how things actually work. With spring, are all lookup mappings etc. done at startup, so at runtime spring looks at its own inner mappings for DI/AOP/etc. instead...

Interfaces, Static Inner Classes and Best Practices

So, this is a question of coding style more or less. I'm using Bean Validation here but the idea is the same for any interface that has simple implementations that aren't likely to get changed all that often. @Target( { METHOD, FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) @Constraint(validatedBy = PhoneNumber.PhoneNumberValidator.clas...

How to include Jax-ws annotations in Javadoc

I want to add Jax-ws annotations to my Javadocs for service interfaces, such as @WebService(name = "CommentService", targetNamespace = "http://xxx.org/wsdl/comment") @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) public interface CommentService exte...

Why the JVM omit the Annotation

i am debugging a application using OSGi, i terribly find out that if the Annotation class is missing, the class loader would omit that annotation, if i call the method.getAnnotations(), no exception, but return nothing. i don't get it, but i do want to know if there is any way to make the JVM throw a Exception. is there any option for s...

How to supply value to an annotation from a Constant java

I am thinking this may not be possible in Java because annotation and its parameters are resolved at compile time. I have an interface as follows, public interface FieldValues { String[] FIELD1 = new String[]{"value1", "value2"}; } and another class as, @SomeAnnotation(locations = {"value1", "value2"}) public class MyClass { .....

MKMapView -> display a button for my location

Hello to all! I have a MKMapView implemented with these lines of source code (my location is a blue bullet, the other one's are purple pins): - (MKAnnotationView *)mapView:(MKMapView *)mapViewLocal viewForAnnotation:(id <MKAnnotation>)annotation { if (annotation == mapViewLocal.userLocation) { mapViewLocal.userLocation.titl...

Where can I find all of the "things" Data Annotation can do (Validation)

Where do they list the attribute (things that you can do with the Data Annotation validation framework). Like, [Required] .... ...