annotations

JSF 2.0 Problem (faces-config)

We have faces-config.xml in JSF 1.0 where we entry about managed-beans, dependencies & navigations etc. I was developing a sample project using JSF 2.0. But, as I don't know annotation, I need to include face-config.xml externally. Please, provide the solution for it, as in JSF 2.0 we don't need to include it. What is reason behind it? ...

Hibernate exception when starting Tomcat (after upgrade to hibernate-3.5.0)

I'm getting the following exception when starting a tomcat instance with my web app after upgrading to hibernate 3.5.0: org.hibernate.annotations.common.AssertionFailure: Fail to process type argument in a generic declaration. Type: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl at org.hibernate.ejb.metamodel.Attri...

Annotation based data structure visualization - are there similar tools out there?

For a project at university I plan to build an annotation based tool to visualize/play around with data structures. Here's my idea: Students which want to try out their self-written data structures need to: mark the type of their data structures using some sort of marker annotation e.g. @List public class MyList { ... } so that I k...

MKMapView Pins Refreshing Color on Click

Hello, I have several custom MKPinAnnotationView on my map with different images(colored pins). Everything works fine until I either click on a pin or change the map to a different view(satellite/road)... when I do either of these, my pins will revert back to the classic red color. Any help would be greatly appreciated. ...

How to hook custom compiler logic based on annotations

I want to define a few annotations that will allow extra warnings/errors to be reported during compilation (similar in concept to the @Nullable and @NotNull annotations in IntelliJ). I would like to be able to write some compiler hooks that will also add my compilation logic based on those attributes. I want a generic hook if possible,...

Java: Trace execution of a dynamically loaded class

Hi, basically what i'm trying to do is to load dynamically a class with annotated methods, run the main method of the class then trigger some code when the annotated methods are called. Exemple : public myclass { public static void myMethod1(){ mymethod2(); } @trace public static void myMethod2(){ ... some code here ... } public st...

Spring annotation with xml mixing problem

I'm trying to find an optimal way to use the latest Spring 3.0. I really like the @RequestMapping annotation with all features applied to it. However, what I don't like, is that the URL bound to the action should be fully specified in the java file. It would be the best to somehow send the whole url-binding configuration to the context ...

How-to dynamically fill a annotation.

Sadly, I forgot to take the code from work with me today. But maybe this little example will clarify things. I use hibernate to map a bean to a table. Example: import javax.persistence.column; …. String columnameA; …. @Column(name="columnameA") public String getColumname(){ return columnameA } …. I do not want to hardcode the colu...

How to capture an Enum from an AnnotationValue in an Annotation Processor

I am trying to read the value of an enum in an annotation using an annotation processor and annotation mirror, but I am getting back null. I think this has to do with the AnnotationValue wrapping an Enum as a VariableElement. The doc for VariableElement#getConstantValue() says "Returns the value of this variable if this is a final field ...

iPhone: Can't get mapkit custom annotation image to work

I figured that using my own custom pin image for annotations would be super easy. But, I have never been able to get it to work, and I have no idea why! I am simply using: Annotation *anno = [[[Annotation alloc] init] autorelease]; anno.coordinate = ridesMap.userLocation.location.coordinate; anno.title = @"Current Loca...

Django query to get next previous item by date in category...

Hello. First time poster to Stack Overflow... I suspect my answer lies in this solution: http://stackoverflow.com/questions/2074514/django-query-that-get-most-recent-objects-from-different-categories but I am having trouble 'getting' Django's annotate() functionality. I've gotten this far: previous = Item.objects.filter(date_added...

annotations retention policy

Can anyone explain me in a clear way what does meaning the java.lang.annotation.RetentionPolicy costants SOURCE, CLASS, RUNTIME? and the term ""retaining annotation"" !!! ...

codestyle; put javadoc before or after annotation?

I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a coding standard? /** * This is a javadoc comment before the annotation */ @Component public class MyClass { @Autowired /** * This is a javadoc comme...

ClassCastException in Annotated WebService in JBoss & Java 6

I am using JBoss 4.0 for creating a simple Web Service using the @WebService annotation as described in http://www.jtraining.com/blogs/java-web-services-getting-started.html. However, when I hit the service as if it is a servlet (as per the instructions in this article), I am getting a ClassCastException stating that my annotated webserv...

checkstyle rule for jcip annotations

Hi, I want a rule that checks that fields and classes are properly annotated with the java concurrency in practice annotations provided by: http://mvnrepository.com/artifact/net.jcip/jcip-annotations Fields have to be annotated with @GuardedBy and classes have to be annotated with one of @Immutable, @ThreadSafe or @NotThreadSafe. I h...

Jackson not recognizing @JsonCreator annotation

I am currently using Jackson 1.4.2 and attempting deserialization of 'code' values (unique identifiers for type information) that are passed from our UI back to the Java controllers (Servlets). There are multiple types (e.g. ABCType, XYZType, etc.) that all extend from an AbstractType, but each concrete type has a static factory method...

Where should I put @Transactional annotation: at an interface definition or at an implementing class?

The question from the title in code: @Transactional (readonly = true) public interface FooService { void doSmth (); } public class FooServiceImpl implements FooService { ... } vs public interface FooService { void doSmth (); } @Transactional (readonly = true) public class FooServiceImpl implements FooService { ... } ...

How do I draw custom "Callout Bubbles" (the place name transparent-gray overlay) in an iPhone application using non-google maps ?

Hello, I'm building an iPhone application with a map inside (using route-me, not MapKit). I have some markers on the map, and I want to have an overlay - similarly to the google maps one - that appears once you click a marker: A black - a bit transparent - overlay, with a button inside, and a little triangle pointing to the marker th...

Netbeans php annotations for code completition

What are useful php annotations for Netbeans code completition? I'm already familiar with @return, @param and @throws, but are there any others? For example, can I set which keys will returned ArrayObject have? In this example, I'd like IDE to suggest me foo and bar after I type get()->. Is it even possible? If so, how? /** * @ ??? *...

Force annotated Class to contain annotated Field

Is it possible to force (at compile-time) an annotated Class to have a an annotated Field? I have this annotations: @Target(value = ElementType.TYPE) @interface MyClass {} @Target(value = ElementType.FIELD) @interface MyField {} and now I would like that the compilation of a Class like this fails: @MyClass class Customer { } whe...