public interface MessageReflector
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.
Modifier and Type | Method and Description |
---|---|
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> |
getFieldValueAsRawString(Object message,
String name)
Get the value of a reflectable field in a message as a string.
|
<R extends XString> |
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.
|
boolean needsSync()
boolean fieldExists(Object message, String name)
message
- The message to check in.name
- The field to check for.boolean isFieldReflectable(Object message, String name)
message
- The message to check in.name
- The field to check for.String getFieldValueAsString(Object message, String name)
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.
message
- The message to introspect.name
- The field whose value is to be retrieved specified as a bean pathfieldExists(java.lang.Object, java.lang.String)
and isFieldReflectable(java.lang.Object, java.lang.String)
methodsString getFieldValueAsString(Object message, String[] pathComponents)
message
- The message to introspect.pathComponents
- The path components to use to access the field.fieldExists(java.lang.Object, java.lang.String)
and isFieldReflectable(java.lang.Object, java.lang.String)
methods<R extends XString> R getFieldValueAsRawString(Object message, String name)
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.
message
- The message to introspect.name
- The field whose value is to be retrieved specified as a bean pathfieldExists(java.lang.Object, java.lang.String)
and isFieldReflectable(java.lang.Object, java.lang.String)
methods<R extends XString> R getFieldValueAsRawString(Object message, String[] pathComponents)
message
- The message to introspect.pathComponents
- The path components to use to access the field.fieldExists(java.lang.Object, java.lang.String)
and isFieldReflectable(java.lang.Object, java.lang.String)
methodsboolean appendFieldValueTo(Object message, String path, XString target)
If the field is reflectable and has a non null value, then it will be appended otherwise, this method must return false.
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.boolean appendFieldValueTo(Object message, String[] pathComponents, XString target)
If the field is reflectable and has a non null value, then it will be appended otherwise, this method must return false.
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.Copyright © 2019 Neeve Research, LLC. All Rights Reserved.