| Author |
define method execute order in java
|
jim li
Ranch Hand
Joined: May 20, 2008
Posts: 177
|
|
class test{
public void test1(){}
public void test2(){}
public void test3(){}
}
when i call method test1(), i want test2() method to be executed before test1() is invoked, and test3() method be excuted after test1() finishes .
is there any annotation allow me to do this.
appreciate your help
|
 |
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 2542
|
|
In general, no, I don't think so.
In the context of a testing framework like JUnit or TestNG, then yes. Can you be more specific what you're trying to do?
|
 |
jim li
Ranch Hand
Joined: May 20, 2008
Posts: 177
|
|
Greg Charles wrote:In general, no, I don't think so.
In the context of a testing framework like JUnit or TestNG, then yes. Can you be more specific what you're trying to do?
when i invoke the persist method in hibernate, i want to execute some methods before and after the persist method.
tx for the help
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
jim li wrote:tx
Please UseRealWords: "thanks".
You could try to check out AspectJ. This allows you to surround method calls with other code.
|
 |
 |
|
|
subject: define method execute order in java
|
|
|