You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "John D. Ament" <jo...@apache.org> on 2015/08/01 23:22:53 UTC

Mapping Expression Config

Hi,

I'd like to propose adding a new annotation to the suite of annotations
supported by the data module - @MappingExpression or
@MappingExpressionConfig

The idea is that we could bind an EL expression to the mapping of a query
result to a dto, as well as converting an input dto to the entity class.  I
was figuring the declaration could look something like this

@MappingExpression("#{someBean.toDto}")
public List<Dto> findBy...();

Where the class is implemented as

@ApplicationScoped
@Named("someBean")
public  class Something {
   public Dto toDto(Entity entity) {
      ...
   }
}

This avoids needing to implement the heavy interface that we currently use
to do mapping, and makes it more single focus.

My goal is to be able to provide mapstruct (http://mapstruct.org/) based
code generated beans with names that can then be plugged into this call
chain.

John