Class ContentMap

java.lang.Object
org.openehealth.ipf.commons.core.ContentMap
Direct Known Subclasses:
Document

public class ContentMap extends Object
Content map based on Spring type conversion framework.
Author:
Dmytro Rud TODO this is only used in ipf-commons-ihe-xds
  • Constructor Details

    • ContentMap

      public ContentMap()
  • Method Details

    • getContent

      public <T> T getContent(Class<T> targetType)
      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

      public <T> T setContent(Class<T> key, T content)
      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

      public <T> T removeContent(Class<T> key)
      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

      public boolean hasContent(Class<?> key)
      Returns true 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

      public static TypeConverter getConversionService()
      Returns conversion service for document contents.
    • setConversionService

      public static void setConversionService(TypeConverter conversionService)
      Sets conversion service for document contents.