|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PlasticMethod
A method of a transformed class.
No methods of this object should be invoked after the class transformation is completed.
Method Summary | |
---|---|
PlasticMethod |
addAdvice(MethodAdvice advice)
Adds advice to the method. |
PlasticMethod |
changeImplementation(InstructionBuilderCallback callback)
Clears the instructions for this method, and creates a new empty InstructionBuilder so that the implementation of the method can be specified. |
PlasticMethod |
delegateTo(PlasticField field)
Changes the implementation of the method to delegate to the provided field. |
PlasticMethod |
delegateTo(PlasticMethod method)
Much like delegateTo(PlasticField) , but the object to delegate to
is dynamically computed by another method of the class. |
MethodDescription |
getDescription()
Returns a representation of the method's name, return value, argument types, etc. |
MethodHandle |
getHandle()
Returns a handle that can be used to invoke a method of a transformed class instance. |
String |
getMethodIdentifier()
Returns a short identifier for the method that includes the class name, the method name, and the types of all parameters. |
List<MethodParameter> |
getParameters()
Returns access to the parameters of the method and, in particular, the visible annotations on those parameters. |
PlasticClass |
getPlasticClass()
Returns the PlasticClass containing this method. |
boolean |
isOverride()
Returns true if the method is an override of a method from the parent class. |
boolean |
isVoid()
Returns true if this method is type void. |
Methods inherited from interface org.apache.tapestry5.plastic.AnnotationAccess |
---|
getAnnotation, hasAnnotation |
Method Detail |
---|
PlasticClass getPlasticClass()
MethodDescription getDescription()
MethodHandle getHandle()
PlasticMethod changeImplementation(InstructionBuilderCallback callback)
callback
- passed the InstructionBuilder so that an implementation of the method can be created
PlasticMethod addAdvice(MethodAdvice advice)
MethodInvocation
and should invoke MethodInvocation.proceed()
to pass control to the next piece
of advice (and ultimately, to the actual method invocation).
If a method implementation is changed, using changeImplementation(InstructionBuilderCallback)
, that
change will be honored, but the logic will only be invoked at the end of the chain of MethodAdvice. Internally, a
new method is created with the same parameters, exceptions, return type and implementation (bytecode) as the
advised method, then the advised method's implementation is changed.
Note additionally that a recursive method invocation will still invoke the MethodAdvice chain on each recursive
call (this is an intended side-effect of copying the exact bytecode of the method implementation.
advice
- advice to add to the method
PlasticMethod delegateTo(PlasticField field)
changeImplementation(InstructionBuilderCallback)
), method advice is retained.
field
- to delegate to
PlasticMethod delegateTo(PlasticMethod method)
delegateTo(PlasticField)
, but the object to delegate to
is dynamically computed by another method of the class. The method should take no parameters
and must not return null, or throw any exceptions not compatible with the method being proxied.
method
- to provide the dynamic delegate
List<MethodParameter> getParameters()
boolean isOverride()
String getMethodIdentifier()
MethodDescription.toShortString()
boolean isVoid()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |