Package org.openehealth.ipf.commons.core
Class ContentMap
java.lang.Object
org.openehealth.ipf.commons.core.ContentMap
- Direct Known Subclasses:
Document
Content map based on Spring type conversion framework.
- Author:
- Dmytro Rud TODO this is only used in ipf-commons-ihe-xds
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
getContent
(Class<T> targetType) Returns document content of the given type.int
Returns count of currently available content types in this content map.static TypeConverter
Returns conversion service for document contents.boolean
hasContent
(Class<?> key) Returnstrue
when this content map already contains an element of the given type.<T> T
removeContent
(Class<T> key) Removes (invalidates) document content of the given type.<T> T
setContent
(Class<T> key, T content) Adds or replaces document content of the given type.static void
setConversionService
(TypeConverter conversionService) Sets conversion service for document contents.
-
Constructor Details
-
ContentMap
public ContentMap()
-
-
Method Details
-
getContent
Returns document content of the given type.- Type Parameters:
T
- inferred desired content type.- Parameters:
targetType
- desired content type.- Returns:
- content of the given type, or
null
when content of the desired type is neither already present nor can be automatically generated from an existing one.
-
setContent
Adds or replaces document content of the given type.- Type Parameters:
T
- inferred content type.- Parameters:
key
- content type.content
- content;null
values are not allowed.- Returns:
- the given content, as convenience.
-
removeContent
Removes (invalidates) document content of the given type.- Type Parameters:
T
- inferred content type.- Parameters:
key
- content type.- Returns:
- Obsolete content of the given type, or
null
, when no content of the given type was present.
-
hasContent
Returnstrue
when this content map already contains an element of the given type. -
getContentsCount
public int getContentsCount()Returns count of currently available content types in this content map. -
getConversionService
Returns conversion service for document contents. -
setConversionService
Sets conversion service for document contents.
-