Annotation « aspectj « Java Enterprise Q&A





1. Adding validations to Java Beans via Annotations    stackoverflow.com

I want to add validations to a Java Bean. For example, I want to do the following:

@MaxLength(50)
@RequiredField
public void setEmployeeName(String name){
   .....
}
I know I can write code that gets ...

2. AspectJ expose annotation value using AspectJ annotations    stackoverflow.com

I'm using AspectJ annotations instead of writing actual aspect files. I want to expose an annotation value to my advice. I currently have this but it it doesn't expose the values ...

3. how to write an aspectj itd to add an annotation to a method?    stackoverflow.com

I am new to aspectj but I want to write an aspectj ITD which allows me to put an annotation on a method. Can anybody help me with it? Thanks Shekhar

4. aspectj - how to find a method of an annotated class is calling another method of same class. i.e. nested calls    stackoverflow.com

I have an annotation @AppManaged which is used to signify classes that need to have certain behavior woven in. One behavior woven in is converting method calls into concurrent GPars(a groovy ...

5. AspectJ - how to access to method with params who are annotated by ElementType.FIELD    stackoverflow.com

I have class with field who are annotated ElementType.FIELD, and a method whitch inside make samething on myObject (by another object):

 public MyClass {

     @MyAdnnotation("Test")
   ...

6. Turning one annotation into many annotations with AspectJ    stackoverflow.com

I have discovered a pattern in my JPA mappings that I would like to codify. A simple example follows:

@OneToMany(fetch=FetchType.EAGER)
@Sort(type=SortType.NATURAL)
private SortedSet<Item> items;
I would like to create a single annotation called SortedOneToMany that ...

7. @AspectJ pointcut for subclasses of a class with an annotation    stackoverflow.com

I'm looking for a pointcut that matches method executions in classes that subclass a class with a specific annotation. The excellent AspectJ cheat sheet helped me to create the ...

8. @AspectJ pointcut for methods that override an interface method with an annotation    stackoverflow.com

How can I write an aspectj pointcut that applies to method executions which override an interface method with an annotation? For example:

interface A {
  @MyAnnotation void method();
}
class B implements A ...

9. Using AOP or Annotations to extend a service functionality    stackoverflow.com

I would like to know what is the best way in which I can extend an existing functionality (probably by using AOP or Annotations). The scenario which I am looking for ...





10. How to match a method with an annotated argument in AspectJ    stackoverflow.com

I'd like to match a method like this:

@Foo
public void boo(@Baz Bar bar) { ... }
Basically:
  • the method has a @Foo annotation (which I match with execution(@Foo * *(..)) && @annotation(foo)),
  • can have a ...

11. How to filter the return values of a method with AspectJ?    stackoverflow.com

I would like to filter return values of methods which have a @Filter annotation and return a Collection, an Array or a Map by a certain predicate. I tried something like:

  ...

12. AspectJ with annotations for authorization    coderanch.com

We would like to use AOP to help restrict object access to users who have specific privileges. We would like to use AspectJ. One way to do this is to use annotations to specify which privileges the class would require. However, this seems a lot like hard-coding. Any change in privileges would require class level changes and a recompile. Granted, there ...