ElementOutputListMapperExpander

Expands:


    $componentRoot.directory$/$artifactSubFolders$/$dataElement.packageName;format="toPath"$/mapper/$dataElement.name;format="firstToLower"$
  /$dataElement.name$OutputListMapper.java

if:

dataElement.component.getOption("enableJaxrs").defined and
    dataElement.getOption('includeJaxrsConnector').defined and
    dataElement.getOption('exposeGetListEndpoint').defined
property value
element type DataElement
qualified name net.democritus.expander.rest.control.mapper.ElementOutputListMapperExpander
layer CONTROL_LAYER
technology JAXRS
sourceType JAVA
phase expansion
features  

Example

Some example of the content generated by the expander:

// expanded with nsx-expanders:4.16.3, expansionResource net.democritus:rest-expanders:2.4.2
package net.animals.mapper.catBreed;

import net.animals.model.catBreed.CatBreedOutputListModel;
import net.animals.model.catBreed.CatBreedOutputModel;
import net.animals.CatBreedDetails;

import net.democritus.sys.Context;
import net.democritus.sys.ParameterContext;

import java.util.List;

// @anchor:imports:start
// @anchor:imports:end
// anchor:custom-imports:start
// anchor:custom-imports:end

public class CatBreedOutputListMapper {

  private CatBreedOutputMapper catBreedMapper = new CatBreedOutputMapper();

  // @anchor:fields:start
  // @anchor:fields:end
  // anchor:custom-fields:start
  // anchor:custom-fields:end

  public CatBreedOutputListModel toExternal(ParameterContext<List<CatBreedDetails>> inputModelsParameter) {
    Context context = inputModelsParameter.getContext();
    List<CatBreedDetails> inputModels = inputModelsParameter.getValue();
    CatBreedOutputListModel list = new CatBreedOutputListModel();

    for (CatBreedDetails result : inputModels) {
      CatBreedOutputModel catBreedOutputModel = catBreedMapper.toExternal(inputModelsParameter.construct(result));
      // @anchor:list-mapping:start
      // @anchor:list-mapping:end
      // anchor:custom-list-mapping:start
      // anchor:custom-list-mapping:end

      list.addCatBreed(catBreedOutputModel);
    }

    // @anchor:mapping:start
    // @anchor:mapping:end
    // anchor:custom-mapping:start
    // anchor:custom-mapping:end

    return list;
  }

  // @anchor:methods:start
  // @anchor:methods:end
  // anchor:custom-methods:start
  // anchor:custom-methods:end

}

These expanders have the same isApplicable as ElementOutputListMapperExpander.