Interface DataMapper

All Known Subinterfaces:
CMSDataMapper, CMSDataMapper
All Known Implementing Classes:
DefaultCMSDataMapper, DefaultCMSDataMapper, DefaultDataMapper

public interface DataMapper
Interface for data mapper that wraps MapperFacade and adds property filtering.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Field prefix added to destination object field name
    static final String
    Field set name used in mapping context
    static final String
    Flag used in mapping context.
  • Method Summary

    Modifier and Type
    Method
    Description
    <S, D> void
    map(S sourceObject, D destinationObject)
    Maps the properties of sourceObject onto destinationObject.
    <S, D> void
    map(S sourceObject, D destinationObject, boolean mapNulls)
    Maps the properties of sourceObject onto destinationObject.
    <S, D> void
    map(S sourceObject, D destinationObject, String fields)
    Maps the properties of sourceObject onto destinationObject.
    <S, D> void
    map(S sourceObject, D destinationObject, String fields, boolean mapNulls)
    Maps the properties of sourceObject onto destinationObject.
    <S, D> D
    map(S sourceObject, Class<D> destinationClass)
    Create and return a new instance of type D mapped with the properties of sourceObject.
    <S, D> D
    map(S sourceObject, Class<D> destinationClass, String fields)
    Create and return a new instance of type D mapped with the specified fields of sourceObject.
    <S, D> D
    map(S sourceObject, Class<D> destinationClass, Set<String> fields)
    Create and return a new instance of type D mapped with the specified fields of sourceObject.
    <S, D> void
    mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, String fields)
    Map an iterable onto an existing collection
    <S, D> List<D>
    mapAsList(Iterable<S> source, Class<D> destinationClass, String fields)
    Maps the source Iterable into a new List parameterized by destinationClass.
    <S, D> Set<D>
    mapAsSet(Iterable<S> source, Class<D> destinationClass, String fields)
    Maps the source iterable into a new Set parameterized by destinationClass.
    <S, D> void
    mapGeneric(S sourceObject, D destObject, Type[] sourceActualTypeArguments, Type[] destActualTypeArguments, String fields, Map<String,Class> destTypeVariableMap)
    Maps the properties of sourceObject onto destinationObject, using sourceActualTypeArguments and destActualTypeArguments to specify the arguments of parameterized types of the source and destination object.
  • Field Details

    • FIELD_SET_NAME

      static final String FIELD_SET_NAME
      Field set name used in mapping context
      See Also:
    • MAP_NULLS

      static final String MAP_NULLS
      Flag used in mapping context. Decides whether nulls are mapped or ignored.
      See Also:
    • FIELD_PREFIX

      static final String FIELD_PREFIX
      Field prefix added to destination object field name
      See Also:
  • Method Details

    • map

      <S, D> D map(S sourceObject, Class<D> destinationClass)
      Create and return a new instance of type D mapped with the properties of sourceObject.
      Parameters:
      sourceObject - the object to map from
      destinationClass - the type of the new object to return
      Returns:
      a new instance of type D mapped with the properties of sourceObject
    • map

      <S, D> D map(S sourceObject, Class<D> destinationClass, String fields)
      Create and return a new instance of type D mapped with the specified fields of sourceObject.
      Parameters:
      sourceObject - the object to map from
      destinationClass - the type of the new object to return
      fields - comma-separated fields to map
      Returns:
      a new instance of type D mapped with the fields of sourceObject
    • map

      <S, D> D map(S sourceObject, Class<D> destinationClass, Set<String> fields)
      Create and return a new instance of type D mapped with the specified fields of sourceObject.
      Parameters:
      sourceObject - the object to map from
      destinationClass - the type of the new object to return
      fields - set of fully qualified field names to map
      Returns:
      a new instance of type D mapped with the fields of sourceObject
    • map

      <S, D> void map(S sourceObject, D destinationObject)
      Maps the properties of sourceObject onto destinationObject.
      Parameters:
      sourceObject - the object from which to read the properties
      destinationObject - the object onto which the properties should be mapped
    • map

      <S, D> void map(S sourceObject, D destinationObject, boolean mapNulls)
      Maps the properties of sourceObject onto destinationObject.
      Parameters:
      sourceObject - the object from which to read the properties
      destinationObject - the object onto which the properties should be mapped
      mapNulls - controls whether nulls are mapped or ignored
    • map

      <S, D> void map(S sourceObject, D destinationObject, String fields)
      Maps the properties of sourceObject onto destinationObject.
      Parameters:
      sourceObject - the object from which to read the properties
      destinationObject - the object onto which the properties should be mapped
      fields - comma-separated fields to map
    • map

      <S, D> void map(S sourceObject, D destinationObject, String fields, boolean mapNulls)
      Maps the properties of sourceObject onto destinationObject.
      Parameters:
      sourceObject - the object from which to read the properties
      destinationObject - the object onto which the properties should be mapped
      fields - comma-separated fields to map
      mapNulls - controls whether nulls are mapped or ignored
    • mapAsSet

      <S, D> Set<D> mapAsSet(Iterable<S> source, Class<D> destinationClass, String fields)
      Maps the source iterable into a new Set parameterized by destinationClass.
      Parameters:
      source - the Iterable from which to map
      destinationClass - the type of elements to be contained in the returned Set.
      fields - comma-separated fields to map
      Returns:
      a new Set containing elements of type destinationClass mapped from the elements of source.
    • mapAsList

      <S, D> List<D> mapAsList(Iterable<S> source, Class<D> destinationClass, String fields)
      Maps the source Iterable into a new List parameterized by destinationClass.
      Parameters:
      source - the Iterable from which to map
      destinationClass - the type of elements to be contained in the returned Set.
      fields - comma-separated fields to map
      Returns:
      a new List containing elements of type destinationClass mapped from the elements of source.
    • mapAsCollection

      <S, D> void mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, String fields)
      Map an iterable onto an existing collection
      Parameters:
      source - the source iterable
      destination - the destination collection
      destinationClass - the type of elements in the destination
      fields - comma-separated fields to map
    • mapGeneric

      <S, D> void mapGeneric(S sourceObject, D destObject, Type[] sourceActualTypeArguments, Type[] destActualTypeArguments, String fields, Map<String,Class> destTypeVariableMap)
      Maps the properties of sourceObject onto destinationObject, using sourceActualTypeArguments and destActualTypeArguments to specify the arguments of parameterized types of the source and destination object.
      Parameters:
      sourceObject - the object from which to read the properties
      destObject - the object onto which the properties should be mapped
      sourceActualTypeArguments - arguments of source type
      e.g. if we have type class like ProductSearchPageData<SearchStateData, ProductData> we should give {SearchStateData.class,ProductData.class}
      destActualTypeArguments - arguments of dest type<br\> e.g. if we have type class like ProductSearchPageData<SearchStateData, ProductData> we should give {SearchStateData.class,ProductData.class}
      fields - comma-separated fields to map
      destTypeVariableMap - - map containing information about types used in generic class
      e.g. if we have type class like ProductSearchPageData<STATE, RESULT> we should give map like {STATE=SearchStateData.class, RESULT=ProductData.class}