Class MessageProxy


  • public final class MessageProxy
    extends java.lang.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​(java.lang.Class<T> messageClass,
                                 java.lang.Object instance,
                                 java.lang.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​(java.lang.Class<T> messageClass,
                                 java.lang.Object instance,
                                 java.util.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​(java.lang.Class<T> messageClass,
                                    java.lang.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​(java.lang.Class<T> messageClass,
                                    java.util.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 java.lang.String message​(java.lang.Object proxy)
        Build the message from a proxy
        Parameters:
        proxy - message builder proxy
        Returns:
        generated message.