Annotation Type Proxy


  • @Retention(RUNTIME)
    @Target(FIELD)
    public @interface Proxy
    Mark a field referencing an interface implementation to be wrapped by an interface proxy. The field must refer to the desired implementation after delegate instantiation - the easiest way is to initialize the field with the right value. The field value will be wrapped in a proxy, which will be set as the new field value during code attachment. This way the implementation of the interface may be freely changed, while the reference passed to external code remains constant.

    The field type must be that of the desired interface rather than the implementation.

    By default, the interface will be called on the active root thread, even if the calling thread is different.