Forums Register Login

define method execute order in java

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
 

jim li wrote:tx


Please UseRealWords: "thanks".

You could try to check out AspectJ. This allows you to surround method calls with other code.
And inside of my fortune cookie was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1016 times.
Similar Threads
class and public
Reference Variable Casting
Inheritance Confusion
protected field
inheritance for Object class
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:45:43.