Interface ConnectMessagePart<T>
- Type Parameters:
T
- The type of the content of this ConnectMessagePart
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractConnectMessagePart
,ConnectMessagePartByteArrayImpl
,ConnectMessagePartDocumentImpl
,ConnectMessagePartFileImpl
,ConnectMessagePartLargeFileImpl
,ConnectMessagePartObjectImpl
,ConnectMessagePartStringImpl
ConnectMessageParts are stored within a
ConnectMessage
. Each ConnectMessagePart contains properties and a
specific part data type.- Author:
- kgarstman
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperties
(Properties properties) Adds all properties in props to this ConnectMessagePart properties.void
addProperty
(Object key, Object value) Adds a property to this ConnectMessagePart properties.boolean
containsProperty
(Object key) Tests if the specified key is a property in this ConnectMessagePart.Gets the data content of this ConnectMessagePart.getId()
Gets the partId of this ConnectMessagePart.int
Gets the part number of this ConnectMessagePart.Gets the properties of this ConnectMessagePartgetPropertyValue
(Object key) Gets the value of a property as an Object.Gets the String representation of the content of this ConnectMessagePart.getType()
Gets the ConnectMessagePartContentType of this ConnectMessagePart.boolean
Tests if thesetContent(Object)
will store a reference to the content or make a clone copy of it.void
setCloneContent
(boolean cloneContent) Sets or resets the clone functionality of thesetContent(Object)
method.void
setContent
(T content) Sets the content of this ConnectMessagePart.void
Set the partId of this ConnectMessagePart.void
setPartNumber
(int partNumber) Sets the partNumber of this ConnectMessagePart.void
setProperties
(Properties properties) Sets (and replaces!) the Properties of this ConnectMessagePart.void
setStringContent
(String content) Sets this string as the content of this ConnectMessagePart.toXML()
Gets a simplified XML message of this ConnectMessagePart.
-
Method Details
-
getProperties
Properties getProperties()Gets the properties of this ConnectMessagePart- Returns:
- The properties of this ConnectMessagePart
-
setProperties
Sets (and replaces!) the Properties of this ConnectMessagePart.- Parameters:
properties
- The Properties object to insert into this ConnectMessagePart.
-
getType
ConnectMessagePartContentType getType()Gets the ConnectMessagePartContentType of this ConnectMessagePart.- Returns:
- One of the types defined in
ConnectMessagePartContentType
-
getId
String getId()Gets the partId of this ConnectMessagePart. The partId is the same as the partId used to store the ConnectMessagePart in the ConnectMessage.- Returns:
- The partId
-
setId
Set the partId of this ConnectMessagePart.- Parameters:
id
- The partId to set
-
getPartNumber
int getPartNumber()Gets the part number of this ConnectMessagePart. The part number is set when adding a ConnectMessagePart to the ConnectMessage.- Returns:
- the partnumber
-
setPartNumber
void setPartNumber(int partNumber) Sets the partNumber of this ConnectMessagePart. The partNumber is automatically set when adding the ConnectMessagePart to the ConnectMessage. Once set, a partNumber cannot be changed.- Parameters:
partNumber
- The partnumber to set
-
getContent
T getContent()Gets the data content of this ConnectMessagePart. The returned type is the Object type stored in this ConnectMessagePart.- Returns:
- Object stored in this ConnectMessagePart
-
setContent
Sets the content of this ConnectMessagePart. The type of the content should reflect the type of the ConnectMessagePart. Depending on theisCloneContent()
the content will be stored as a reference or as a clone.- Parameters:
content
- the content to store in this ConnectMessagePart
-
getPropertyValue
Gets the value of a property as an Object. Property key will be searched in ConnectMessagePart properties.- Parameters:
key
- Name of the property to find- Returns:
- The found value as an Object or null if not found
-
addProperty
Adds a property to this ConnectMessagePart properties. If the property key already exists the old value will be overwritten.- Parameters:
key
- Key name of the propertyvalue
- Value of the property to add. If null the property will be emptied.
-
addProperties
Adds all properties in props to this ConnectMessagePart properties. Any existing properties in ConnectMessagePart will be kept unless overwritten by the new properties in props.- Parameters:
properties
- Properties to add
-
getStringContent
String getStringContent()Gets the String representation of the content of this ConnectMessagePart. Each ConnectMessagePart type implementation will have its own implementation of this method.- Returns:
- The string implementation of the content
-
setStringContent
Sets this string as the content of this ConnectMessagePart. Each ConnectMessagePart type implementation will convert the String content to the type of this ConnectMessagePart- Parameters:
content
- The string content to set
-
containsProperty
Tests if the specified key is a property in this ConnectMessagePart.- Parameters:
key
- The property key to test- Returns:
- True if the property is found, false otherwise
-
toXML
String toXML()Gets a simplified XML message of this ConnectMessagePart. Must only be used for logging purposes. The returned XML does not reflect the actual (JABX) XML reference of this ConnectMessagePart.- Returns:
- The simplified XML message as a String
-
isCloneContent
boolean isCloneContent()Tests if thesetContent(Object)
will store a reference to the content or make a clone copy of it.- Returns:
- True if the
setContent(Object)
method will clone the content, false otherwise
-
setCloneContent
void setCloneContent(boolean cloneContent) Sets or resets the clone functionality of thesetContent(Object)
method.- Parameters:
cloneContent
- True to set the clone functionality of thesetContent(Object)
method, false otherwise
-