public final class Unmodifiable extends Object
UnsupportedOperationException
or IllegalArgumentException
.
Note that these wrappers have no HL7-specific type information, e.g. an UnmodifiableMessage
just implements Message
but not some concrete event type. It is possible
to use the Terser
, generic Getter methods, message iterators or visitors.
All structures or types returned by these methods will be unmodifiable as well.
Also note that the original message does not automatically become immutable.Modifier and Type | Method and Description |
---|---|
static boolean |
isUnmodifiable(Object o)
Returns true if the message instance (or a part thereof) is unmodifiable
|
static Message |
unmodifiableMessage(HapiContext context,
String s)
Parses the string to an
UnmodifiableMessage using the specific HapiContext. |
static Message |
unmodifiableMessage(Message msg)
Returns an unmodifiable wrapper around the message.
|
public static Message unmodifiableMessage(Message msg)
UnmodifiableMessage
, they will be unmodifiable as well. Copying these message parts into a regular
message should therefore be done using DeepCopy
.msg
- message to be wrappedpublic static Message unmodifiableMessage(HapiContext context, String s) throws HL7Exception
UnmodifiableMessage
using the specific HapiContext. When accessing structures or types of the
returned message, they will be unmodifiable as well. The returned message caches the original message string,
which is returned when calling Message.encode()
or Message#toString()
.context
- HapiContexts
- message stringHL7Exception
- if parsing failspublic static boolean isUnmodifiable(Object o)
o
- something HAPI-relatedCopyright © 2001–2017 University Health Network. All rights reserved.