method « aspectj « Java Enterprise Q&A





1. Use aspectj to profile selected methods    stackoverflow.com

I'd like to use aspectj to profile a library. My plan was to mark methods that require profiling with an annotation: @Profiled("logicalUnitOfWork") And then have an aspect that would fire before and ...

2. Aspectj. Creating innter type methods in multiple classes    stackoverflow.com

If I put:

public CountryState CountryState.find(long id) {
        return (CountryState) findById(CountryState.class, id);
}
I'm creating a method find in the class CountryState. Is there a way to create ...

3. How can I make external methods interruptable?    stackoverflow.com

The Problem

I'm running multiple invocations of some external method via an ExecutorService. I would like to be able to interrupt these methods, but unfortunately they do not check the ...

4. Restricting method calls to 1 per sec with Java?    stackoverflow.com

I am writing a program, and I would only like the user to be able to make certain method calls every 1 second. I'm having trouble figuring out the best way ...

5. Pointcut to match all calls to public methods, except calls to self    stackoverflow.com

I am attempting to write an aspect which monitors calls to public methods on a variety of objects, but ignore calls to self. For this, I have an aspect like this:

abstract ...

6. How to get the caller method information from Around advise    stackoverflow.com

ThisJoinPoint can only get the current method information, anyway to get the caller method information?

7. Determining which method triggered an aspect    stackoverflow.com

I was wondering if there is anyway of determing what mehtod was active when this aspect was triggered. I found the method JointPoint.getSourceLocation() which returns the source code line. I realised ...

8. AspectJ - pointcut on native method call    stackoverflow.com

Is it possible to set pointcut on native method call with AspectJ? I tried following aspect:

public aspect EmailAspect {
    pointcut conn() : call(* java.net.PlainSocketImpl.socketConnect(..));
    before() ...

9. AspectJ pointcut to method call in specific methods    stackoverflow.com

I want to create a pointcut to target a call to a method from specific methods. take the following:

class Parent {
   public foo() {
     //do something
 ...





10. Can aspectj add methods to java.lang.String    stackoverflow.com

I've read some articles of aspectj, I know it can enhance classes, which is attractive. I've a very stupid question that I can't find a clear answer: Can aspectj add methods to ...

11. Getting return type of generic method call in AspectJ    stackoverflow.com

I've got generic method Foo.foo():

class Foo {
    static native T <T> foo();
}

Bar bar = Foo.foo();
What I need is to replace calls to this method using AspectJ. The problem ...

12. How to generate a unique hash code for a method instance?    stackoverflow.com

I am doing some profiling with Aspectj. I need to identify uniquely the instances of a method where the field been accessed For example:

public class Class{ int a; int b;
public void method1(){

  ...

13. Cannot override method and cannot access field while using idiom "Providing a default interface implementation"    stackoverflow.com

Here is code:
IDefaultInterface.aj:

public interface IDefaultInterface {
    public void m1();   
    static aspect Impl{
        public int f1;
 ...

14. Is it possible to retrieve the object instance performing a method call with AspectJ?    stackoverflow.com

Let's imagine the following aspect:

 aspect FaultHandler {

   pointcut services(Server s): target(s) && call(public * *(..));

   before(Server s): services(s) {
     // How to ...

15. How can I synchronize over Java aspects defined around a method?    stackoverflow.com

I have a Hibernate transactional method "doImportImpl" which runs multi-threaded. Certain records however need to be imported in sequence, so the code structure is roughly like this:

public RecordResult doImportImpl(String data) {
 ...

16. AspectJ MethodSignature Returns Null Method    coderanch.com

Hi. I'm relatively new to AspectJ (used in the past, but not for a while, so I'm a little bit rusty). I've setup a pointcut to catch all method calls, which it does, and then in the advice, I'm trying to print out the actual method that was called. I can do that using the following: thisJoinPoint.getSignature().toString() and that works just ...