Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.plastic
Interface PlasticMethod

All Superinterfaces:
  AnnotationAccess

    public interface PlasticMethod

extends AnnotationAccess

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.
`java.lang.String` | `getMethodIdentifier()` Returns a short identifier for the method that includes the class name, the method name, and the types of all parameters.
`java.util.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

### getPlasticClass

    PlasticClass getPlasticClass()

  Returns the PlasticClass containing this method.

### getDescription

    MethodDescription getDescription()

  Returns a representation of the method's name, return value, argument types, etc.

### getHandle

    MethodHandle getHandle()

  Returns a handle that can be used to invoke a method of a transformed class instance.

### changeImplementation

    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. This may be considered a kind of last resort when no other approach is sufficient.

  If the method is currently abstract, it will have its abstract flag cleared.

  If the method has advice, the advice is not lost but will instead wrap around the new method implementation.

  Parameters:
    `callback` - passed the InstructionBuilder so that an implementation of the method can be created
  Returns:
    this method, for further configuration

### addAdvice

    PlasticMethod addAdvice(MethodAdvice advice)

  Adds advice to the method. Adding advice implicitly rewrites the implementation of the method (this occurs inside at the end of the class transformation). When the method is invoked, control will flow through the MethodAdvice in the order they are added. Each piece of advice will receive the `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.

  Parameters:
    `advice` - advice to add to the method
  Returns:
    this method, for further configuration

### delegateTo

    PlasticMethod delegateTo(PlasticField field)

  Changes the implementation of the method to delegate to the provided field. The field must implement the correct interface (or extend the correct class). The original implementation of the method is lost, though (as with `changeImplementation(InstructionBuilderCallback)`), method advice is retained.

  Parameters:
    `field` - to delegate to
  Returns:
    this method, for further configuration

### delegateTo

    PlasticMethod delegateTo(PlasticMethod method)

  Much like `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.

  Parameters:
    `method` - to provide the dynamic delegate
  Returns:
    this method, for further configuration

### getParameters

    java.util.List<MethodParameter> getParameters()

  Returns access to the parameters of the method and, in particular, the visible annotations on those parameters.

### isOverride

    boolean isOverride()

  Returns true if the method is an override of a method from the parent class.

  Returns:
    true if the parent class contains a method with the name signature

### getMethodIdentifier

    java.lang.String getMethodIdentifier()

  Returns a short identifier for the method that includes the class name, the method name, and the types of all parameters. This is often used when producing debugging output about the method.

  Returns:
    short identifier
  See Also:
    `MethodDescription.toShortString()`

### isVoid

    boolean isVoid()

  Returns true if this method is type void.

  Returns:
    true for void methods.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.