Class MessageBuilderInvocationHandler
- java.lang.Object
-
- org.fluentlenium.core.conditions.message.MessageBuilderInvocationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class MessageBuilderInvocationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandler
Invocation handler that builds message based on called performed.
-
-
Constructor Summary
Constructors Constructor Description MessageBuilderInvocationHandler(java.lang.String context)
Creates a new message builder invocation handler.MessageBuilderInvocationHandler(java.lang.String context, java.lang.Object instance)
Creates a new message builder invocation handler.MessageBuilderInvocationHandler(java.util.List<MessageBuilderCall> calls)
Creates a new message builder invocation handler, with initial calls.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
buildMessage()
Build the message based on annotations from methods called previously.java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
-
-
-
Constructor Detail
-
MessageBuilderInvocationHandler
public MessageBuilderInvocationHandler(java.lang.String context)
Creates a new message builder invocation handler.- Parameters:
context
- base context of the generated message
-
MessageBuilderInvocationHandler
public MessageBuilderInvocationHandler(java.lang.String context, java.lang.Object instance)
Creates a new message builder invocation handler.- Parameters:
context
- base context of the generated messageinstance
- underlying wrapped instance. If not null, calls will also be performed on this instance.
-
MessageBuilderInvocationHandler
public MessageBuilderInvocationHandler(java.util.List<MessageBuilderCall> calls)
Creates a new message builder invocation handler, with initial calls.- Parameters:
calls
- initial calls.
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
buildMessage
public java.lang.String buildMessage()
Build the message based on annotations from methods called previously.- Returns:
- built message
- Throws:
java.lang.IllegalStateException
- if one of the recorded call has no @Message/@NotMessage annotation.
-
-