Package ca.uhn.hl7v2.model
Class Unmodifiable
java.lang.Object
ca.uhn.hl7v2.model.Unmodifiable
A static helper class that allows to obtain unmodifiable message wrappers, i.e. all modification to these wrappers
result in an
UnsupportedOperationException or IllegalArgumentException.
Note that these wrappers have no HL7-specific type information, e.g. an Unmodifiable.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.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns true if the message instance (or a part thereof) is unmodifiablestatic MessageunmodifiableMessage(HapiContext context, String s) Parses the string to anUnmodifiable.UnmodifiableMessageusing the specific HapiContext.static MessageReturns an unmodifiable wrapper around the message.
-
Method Details
-
unmodifiableMessage
Returns an unmodifiable wrapper around the message. When accessing structures or types of theUnmodifiable.UnmodifiableMessage, they will be unmodifiable as well. Copying these message parts into a regular message should therefore be done usingDeepCopy.- Parameters:
msg- message to be wrapped- Returns:
- unmodifiable message wrapper
-
unmodifiableMessage
Parses the string to anUnmodifiable.UnmodifiableMessageusing 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 callingMessage.encode()orMessage#toString().- Parameters:
context- HapiContexts- message string- Returns:
- unmodifiable message wrapper
- Throws:
HL7Exception- if parsing fails
-
isUnmodifiable
Returns true if the message instance (or a part thereof) is unmodifiable- Parameters:
o- something HAPI-related- Returns:
- true if unmodifiable
-