Can I write annotation in Groovy?
I know I can annotate my classes in Groovy with annotations, but can I write the annotation itself in Groovy (as opposed to just using annotation written in Java)? If so, from what version? ...
I know I can annotate my classes in Groovy with annotations, but can I write the annotation itself in Groovy (as opposed to just using annotation written in Java)? If so, from what version? ...
I am setting up Hibernate Caching and want to cache certain entities in different regions. For example, some entities can be "stale" for up to 5 minutes, some for an hour, and some (like lookups) won't change for weeks. To facilitate easy config of regions in my code, I'm trying the following: I created an annotation named @LookupCache ...
How can I retrieve the value of an annotation on the annotated method?? I have: @myAnnotation(attribute1 = value1, attibute2 = value2) public void myMethod() { //I want to get value1 here } ...
I am annotating my map and setting an image just fine, but when I tap the annotation on the MapView, the image goes from my custom image back to the red pin. Why is this? - (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation { MKPinAnnotationView *a = [ [ MKPinAnnotationView alloc ] initWithAnno...
Hello. my question is, to set more Annotation Pins on a map? enter code - (NSArray *) addressLocation { kunden = [NSArray arrayWithObjects:@"Kammlach", @"Mindelheim",@"Ettringen", nil]; NSString *aktuellerKunde; int i; locations = [NSMutableArray arrayWithObjects:@"",nil]; for (i=0; i < [kunden count]; i++) { CLLocationCoordinat...
Here is the typical way of accomplishing this goal: public void myContractualMethod(final String x, final Set<String> y) { if ((x == null) || (x.isEmpty())) { throw new IllegalArgumentException("x cannot be null or empty"); } if (y == null) { throw new IllegalArgumentException("y cannot be null"); } /...
Using annotation-based controller mappings. @Controller public class AlertsController { @RequestMapping(value="create", method=RequestMethod.GET) public void create(HttpServletRequest request, Model model) { } } When access alerts/create, I get the message Does your handler implement a supported interface like Controller?. Thi...
I'm experimenting with java annotation processors. I'm able to write integration tests using the "JavaCompiler" (in fact I'm using "hickory" at the moment). I can run the compile process and analyse the output. The Problem: a single test runs for about half a second even without any code in my annotation processor. This is way too long t...
I have been working on validation with the ASP.NET MVC BETA 2. Some of the reading that I have done is very critical of the buddy class approach because it isn't DRY (Don't Repeat Yourself) and because it puts the buddy class in the model layer and not in the web layer. I understand these arguments and through lots of searching I found a...
I'm working on an Spring application with lots of input forms. I'd like to reuse the field length in the UI-form, validation and JPA annotations. Is there an elegant way to solve this. My solution at the moment is, to use constants to declare the length: public class Person { public static final int FIRSTNAME_LENGTH = 25; @Column...
I have a Java enterprise application that provides a web service, has a domain layer, and a hibernate persistence layer. In this particular case, there is not a huge difference (at the moment) between the objects I send over the wire, the domain objects, and the persistence objects. Currently the application uses DTO's on the persis...
My application is trying to use Hibernate annotations. I've gotten the 3.5.0 version of Hibernate installed, but when I try to load my app I get the following exception: junit.framework.AssertionFailedError: Exception in constructor: testSubscriber (java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil at java.lang.Clas...
This works fine for filtering out methods with the Analyze annotation: for (Method m : ParseTree.class.getMethods()) { if (m.isAnnotationPresent(Analyze.class)) { What if I just want a count, without looping through? Is there some method that returns how many methods in a certain class have a certain annotation? ...
(Code is for Android Actually, I need code to be portable between Android and Java SE.) I want to have a "settings" class with various game settings, like public int map_size; public String server_name; etc. The data needs to be accessed fairly frequently (so members, not a key-value map), and from time to time de/serialized in some...
I'm interested in finding out exactly which Java annotations people think are most useful during development. This doesn't necessarily have to limited to the core Java API, you may include annotations you found in third party libraries or annotations you've developed yourself (make sure you include a link to the source). I'm really i...
Why does this code print 0? @Table(name = "source") public class SourceDetails implements DatabaseEntity{ public static void main(String[] args) { System.out.println(SourceDetails.class.getAnnotations().length); } ... } ...
I've observed the strange fact (based on the questions in the hibernate tag) that people are still actively using xml files instead of annotations to specify their ORM (Hibernate/JPA) mappings. There are a few cases, where this is necessary: you are using classes that are provided, and you want to map them. you are writing an API, who...
Hi all, This question relates to Django Aggregation/Annotation in 1.1. Suppose I have a simple model with an IntegerField that has a "choices" parameter passed to it. In this case, it maps to a GENDERS tuple as shown. Normally, in a template (or view) I can refer to the textual value of the gender by using the get_gender_display() f...
I experiment with java annotation processors and try to understand the usage of the classes in "javax.lang.model". For what I have read I think the ElementVisitor is to be intended as the primary way to work with the model. But I don't understand how to use it properly. I knew the visitor pattern. Up to now I've used it to avoid iterati...
Is there a better standard way to create getters and setters in Java? It is quite verbose to have to explicitly define getters and setters for each variable. Is there a better standard annotations approach? Does Spring have something like this? Even C# has properties. ...