Annotation Interface OverwriteConstructor
Annotates a static method to indicate it will be intercepting a constructor of the target class. The first parameter of the method MUST be the type of the class you are intercepting. All subsequent parameters should be whatever the constructor you are intercepting takes.
For example, if you wanted to intercept:
SomeConstructor(String a, int b)
Your method would be:
public static void whateverName(SomeConstructor inst, String x, String y)
Due to the way in which the JVM verifies constructors, you can have your method be called before or after the intercepted constructor executes (or both), but not neither.
-
Optional Element Summary
Optional Elements
-
Element Details
-
before
boolean before- Returns:
- whether to call your method before the constructor runs.
if false,
after()
must be true.
- Default:
- false
-
after
boolean after- Returns:
- whether to call your method after the constructor runs.
if false,
before()
must be true.
- Default:
- true
-