Interface ICallHandler

  • All Known Implementing Classes:
    MapStructExt

    public interface ICallHandler
    Facilitates dynamic interface method invocation.

    A class can directly or indirectly, via interface extension, implement this interface to support dynamic interface method invocation. Any class implementing this interface can be cast to any interface. Manifold cooperates with the Java compiler to transform calls through an interface to ICallHandler.call().

    Note unlike a proxy or wrapper a class implementing ICallHandler doesn't wrap anything, therefore it doesn't lose its identity in the process of making calls.

    See Also:
    "MapStructExt"
    • Field Detail

      • UNHANDLED

        static final Object UNHANDLED
        A value resulting from #call() indicating the call could not be dispatched.
    • Method Detail

      • call

        Object call​(Object proxy,
                    Class<?> iface,
                    String name,
                    String actualName,
                    Class<?> returnType,
                    Class<?>[] paramTypes,
                    Object[] args)
        Dispatch a call to an interface method.
        Parameters:
        proxy - The proxy instance delegating this call, null if not a proxy
        iface - The extended interface and owner of the method
        name - The name of the method
        actualName - The actual name of the property associated with the method e.g., a Json name that is not a legal Java identifier, can be null
        returnType - The return type of the method
        paramTypes - The parameter types of the method
        args - The arguments from the call site
        Returns:
        The result of the method call or UNHANDLED if the method is not dispatched. Null if the method's return type is void.