Class MessageProxy


  • public final class MessageProxy
    extends Object
    Provides message proxy implementations of interface that records calls to build message from methods annotated with Message, NotMessage and MessageContext.
    • Method Detail

      • wrap

        public static <T> T wrap​(Class<T> messageClass,
                                 Object instance,
                                 String context)
        Wrap an object into a message proxy supporting Message, NotMessage and MessageContext.
        Type Parameters:
        T - type of the class to wrap.
        Parameters:
        messageClass - class to wrap in the proxy.
        instance - original instance.
        context - initial context for generated message.
        Returns:
        a proxy generating message from annotations.
      • wrap

        public static <T> T wrap​(Class<T> messageClass,
                                 Object instance,
                                 List<MessageBuilderCall> calls)
        Wrap an object into a message proxy supporting Message, NotMessage and MessageContext.
        Type Parameters:
        T - type of the class to wrap.
        Parameters:
        messageClass - class to wrap in the proxy.
        instance - original instance.
        calls - call stack of the proxy.
        Returns:
        a proxy generating message from annotations.
      • builder

        public static <T> T builder​(Class<T> messageClass,
                                    String context)
        Build a message proxy supporting Message, NotMessage and MessageContext.
        Type Parameters:
        T - type of the class to wrap.
        Parameters:
        messageClass - class to wrap in the proxy.
        context - initial context for generated message.
        Returns:
        a proxy generating message from annotations.
      • builder

        public static <T> T builder​(Class<T> messageClass,
                                    List<MessageBuilderCall> calls)
        Build a message proxy supporting Message, NotMessage and MessageContext.
        Type Parameters:
        T - type of the class to wrap.
        Parameters:
        messageClass - class to wrap in the proxy.
        calls - call stack of the proxy.
        Returns:
        a proxy generating message from annotations.
      • message

        public static String message​(Object proxy)
        Build the message from a proxy
        Parameters:
        proxy - message builder proxy
        Returns:
        generated message.