Class ReflectiveMessageValidator
- java.lang.Object
-
- org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator
-
- All Implemented Interfaces:
MessageConsumer
public class ReflectiveMessageValidator extends java.lang.Object implements MessageConsumer
Validates messages and forwards them to other message consumers. In case an issue is found, aMessageIssueExceptionis thrown.
-
-
Constructor Summary
Constructors Constructor Description ReflectiveMessageValidator()When created with this constructor, the validator acts as a message sink.ReflectiveMessageValidator(MessageConsumer delegate)Forward messages to the given consumer unless an issue is found.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume(Message message)Consume a single message.protected java.lang.StringcreatePathString(java.util.Deque<java.lang.Object> accessorStack)protected java.lang.StringgetPropertyName(java.lang.reflect.Method method)protected booleanisGetter(java.lang.reflect.Method method)booleanisValid(java.lang.Object object)Check whether the given object is valid.protected java.util.List<MessageIssue>validate(java.lang.Object object)protected voidvalidate(java.lang.Object object, java.util.List<MessageIssue> issues, java.util.Deque<java.lang.Object> objectStack, java.util.Deque<java.lang.Object> accessorStack)Validate all fields of the given object.
-
-
-
Constructor Detail
-
ReflectiveMessageValidator
public ReflectiveMessageValidator()
When created with this constructor, the validator acts as a message sink.
-
ReflectiveMessageValidator
public ReflectiveMessageValidator(MessageConsumer delegate)
Forward messages to the given consumer unless an issue is found.
-
-
Method Detail
-
consume
public void consume(Message message) throws MessageIssueException, JsonRpcException
Description copied from interface:MessageConsumerConsume a single message.- Specified by:
consumein interfaceMessageConsumer- Throws:
MessageIssueException- when an issue is found that prevents further processing of the messageJsonRpcException- when accessing the JSON-RPC communication channel fails
-
isValid
public boolean isValid(java.lang.Object object)
Check whether the given object is valid. If it is not valid, its issues are not reported.
-
validate
protected java.util.List<MessageIssue> validate(java.lang.Object object)
-
validate
protected void validate(java.lang.Object object, java.util.List<MessageIssue> issues, java.util.Deque<java.lang.Object> objectStack, java.util.Deque<java.lang.Object> accessorStack) throws java.lang.ExceptionValidate all fields of the given object.- Throws:
java.lang.Exception
-
createPathString
protected java.lang.String createPathString(java.util.Deque<java.lang.Object> accessorStack)
-
isGetter
protected boolean isGetter(java.lang.reflect.Method method)
-
getPropertyName
protected java.lang.String getPropertyName(java.lang.reflect.Method method)
-
-