com.neeve.sma
Interface MessageReflector


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 fieldExists(Object message, String name)
          Check if a field of the supplied name exists in a message.
 com.neeve.raw.RawString getFieldValueAsRawString(Object message, String name)
          Get the value of a reflectable field in a message as a string.
 com.neeve.raw.RawString 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

com.neeve.raw.RawString 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

com.neeve.raw.RawString 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.


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