com.neeve.sma
Interface MessageReflector

All Known Implementing Classes:
SrvMonAppBusBindingCreatedMessage, SrvMonAppBusBindingCreateFailedMessage, SrvMonAppBusBindingCreateMessage, SrvMonAppBusBindingDestroyedMessage, SrvMonAppBusBindingDestroyMessage, SrvMonAppBusBindingDownMessage, SrvMonAppBusBindingOpenedMessage, SrvMonAppBusBindingOpenFailedMessage, SrvMonAppBusBindingOpeningMessage, SrvMonAppBusBindingStateChangeMessage, SrvMonAppBusBindingUpMessage, SrvMonAppBusChannelClosedMessage, SrvMonAppBusChannelOpenedMessage, SrvMonAppChannelDownMessage, SrvMonAppChannelUpMessage, SrvMonAppClientConnectMessage, SrvMonAppClientDisconnectMessage, SrvMonAppDuplicateAcknowledgementAlertMessage, SrvMonAppEngineActiveMessage, SrvMonAppEngineCreatedMessage, SrvMonAppEngineStartedMessage, SrvMonAppEngineStoppedMessage, SrvMonAppEngineStoppingMessage, SrvMonAppExceptionMessage, SrvMonAppFlowCreateMessage, SrvMonAppInboundLogExceptionMessage, SrvMonAppLoadedMessage, SrvMonAppMessagingFailedMessage, SrvMonAppMessagingPrestartMessage, SrvMonAppMessagingStartedMessage, SrvMonAppMessagingStartFailedMessage, SrvMonAppOutboundLogExceptionMessage, SrvMonAppOutOfOrderSendCommitCompletionAlertMessage, SrvMonAppSendExceptionMessage, SrvMonAppStateChangeMessage, SrvMonAppStatsAlertMessage, SrvMonAppStoreBindingFailedMessage, SrvMonAppStoreBindingRoleChangedMessage, SrvMonAppStoreMemberDownMessage, SrvMonAppStoreMemberInitCompleteMessage, SrvMonAppStoreMemberUpMessage, SrvMonAppStoreTransactionLogRepairedMessage, SrvMonAppStuckAlertMessage, SrvMonAppUnhandledMessageMessage, SrvMonAppUnloadedMessage, SrvMonHeartbeatMessage, SrvMonInvokeCommandRequest, SrvMonInvokeCommandResponse, SrvMonListCommandsRequest, SrvMonListCommandsResponse, SrvMonMessageBusBindingReconnectedMessage, SrvMonMessageBusBindingReconnectingMessage, SrvMonMessageTraceLoggingExceptionMessage, SrvMonServerInfoRequest, SrvMonServerInfoResponse, SrvMonStartTraceWatchRequest, SrvMonStartTraceWatchResponse, SrvMonStopTraceWatchRequest, SrvMonStopTraceWatchResponse, SrvMonTraceRecord, SrvMonUnhandledMessageMessage

public interface MessageReflector

Represents an SMA message reflector.

A message reflector, part of the generic message view, enables the SMA runtime (and the user) to view a message using a map model i.e. as a set of named fields. This interface defines the message reflection interface. It is used by the SMA runtime to inspect message content for use with channel keys and filters.

Threading:
The SMA runtime assumes that reflectors are not safe for concurrent access by multiple threads.

Method Summary
 boolean appendFieldValueTo(Object message, String[] pathComponents, XString target)
          Appends a reflected field value as a string into the given XString.
 boolean appendFieldValueTo(Object message, String path, XString target)
          Appends a reflected field value as a string into the given XString.
 boolean fieldExists(Object message, String name)
          Check if a field of the supplied name exists in a message.
<R extends XString>
R
getFieldValueAsRawString(Object message, String name)
          Get the value of a reflectable field in a message as a string.
<R extends XString>
R
getFieldValueAsRawString(Object message, String[] pathComponents)
          Get the value of a reflectable field in a message as a string.
 String getFieldValueAsString(Object message, String name)
          Get the value of a reflectable field in a message as a string.
 String getFieldValueAsString(Object message, String[] pathComponents)
          Get the value of a reflectable field in a message as a string.
 boolean isFieldReflectable(Object message, String name)
          Check if a field of the supplied name is reflectable.
 boolean needsSync()
          Check if a view needs to be sync'd for reflection.
 

Method Detail

needsSync

boolean needsSync()
Check if a view needs to be sync'd for reflection.


fieldExists

boolean fieldExists(Object message,
                    String name)
Check if a field of the supplied name exists in a message.

Parameters:
message - The message to check in.
name - The field to check for.
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

isFieldReflectable

boolean isFieldReflectable(Object message,
                           String name)
Check if a field of the supplied name is reflectable.

Parameters:
message - The message to check in.
name - The field to check for.
Returns:
Returns null if a field of the supplied name is either not present in the message or is of a type that makes it non-reflectable.
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

getFieldValueAsString

String getFieldValueAsString(Object message,
                             String name)
Get the value of a reflectable field in a message as a string.

Note that this method is generally less efficient than its variant getFieldValueAsString(Object, String[]) since this method requires splitting the supplied path name into its dot separated path components. In cases where the caller intends to reuse the same path name often, it is better for the caller to supply it in split form.

Parameters:
message - The message to introspect.
name - The field whose value is to be retrieved specified as a bean path
Returns:
Returns null if a field of the supplied name is not in the message or the field is of a type that is not reflectable or the field value is null. The caller should differentiate between these various cases through the use of the fieldExists(java.lang.Object, java.lang.String) and isFieldReflectable(java.lang.Object, java.lang.String) methods
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

getFieldValueAsString

String getFieldValueAsString(Object message,
                             String[] pathComponents)
Get the value of a reflectable field in a message as a string.

Parameters:
message - The message to introspect.
pathComponents - The path components to use to access the field.
Returns:
Returns null if a field of the supplied pathComponents is not in the message or the field is of a type that is not reflectable or the field value is null. The caller should differentiate between these various cases through the use of the fieldExists(java.lang.Object, java.lang.String) and isFieldReflectable(java.lang.Object, java.lang.String) methods
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

getFieldValueAsRawString

<R extends XString> R getFieldValueAsRawString(Object message,
                                               String name)
Get the value of a reflectable field in a message as a string.

Note that this method is generally less efficient than its variant getFieldValueAsString(Object, String[]) since this method requires splitting the supplied path name into its dot separated path components. In cases where the caller intends to reuse the same path name often, it is better for the caller to supply it in split form.

Parameters:
message - The message to introspect.
name - The field whose value is to be retrieved specified as a bean path
Returns:
Returns null if a field of the supplied name is not in the message or the field is of a type that is not reflectable or the field value is null. The caller should differentiate between these various cases through the use of the fieldExists(java.lang.Object, java.lang.String) and isFieldReflectable(java.lang.Object, java.lang.String) methods
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

getFieldValueAsRawString

<R extends XString> R getFieldValueAsRawString(Object message,
                                               String[] pathComponents)
Get the value of a reflectable field in a message as a string.

Parameters:
message - The message to introspect.
pathComponents - The path components to use to access the field.
Returns:
Returns null if a field of the supplied pathComponents is not in the message or the field is of a type that is not reflectable or the field value is null. The caller should differentiate between these various cases through the use of the fieldExists(java.lang.Object, java.lang.String) and isFieldReflectable(java.lang.Object, java.lang.String) methods
Threading:
The SMA runtime treats this method as safe for concurrent access by multiple threads with the caveat that the method will never be concurrenty invoked by multiple threads for the same message. Multiple threads can concurrently invoke this method for different messages.

appendFieldValueTo

boolean appendFieldValueTo(Object message,
                           String path,
                           XString target)
Appends a reflected field value as a string into the given XString.

If the field is reflectable and has a non null value, then it will be appended otherwise, this method must return false.

Parameters:
message - the node on which to reflect (which need not be this object).
path - the bean path to the field.
target - The target XString into which to append the result.
Returns:
true if the field was reflectable and had a value which could be appended, false otherwise.

appendFieldValueTo

boolean appendFieldValueTo(Object message,
                           String[] pathComponents,
                           XString target)
Appends a reflected field value as a string into the given XString.

If the field is reflectable and has a non null value, then it will be appended otherwise, this method must return false.

Parameters:
message - the node on which to reflect (which need not be this object).
pathComponents - the bean path to the field on the provided object split by its '.' separated components.
target - The target XString into which to append the result.
Returns:
true if the field was reflectable and had a value which could be appended, false otherwise.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.