2 * Copyright (C) 2021 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.remote
.dto
.assembler
.converter
;
11 import com
.github
.dozermapper
.core
.DozerConverter
;
13 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
14 import eu
.etaxonomy
.cdm
.remote
.dto
.tdwg
.voc
.TaxonRelationshipTerm
;
20 public class ConstantConverter
extends DozerConverter
<CdmBase
,Object
> {
22 final static String TAX_INCLUDED
= "taxIncluded";
24 public ConstantConverter() {
25 super(CdmBase
.class, Object
.class);
29 public Object
convertTo(CdmBase source
, Object destination
) {
30 if (TAX_INCLUDED
.equals(this.getParameter())){
31 TaxonRelationshipTerm result
= new TaxonRelationshipTerm();
32 result
.setTitle("is taxonomically included in");
35 return this.getParameter();
40 public CdmBase
convertFrom(Object source
, CdmBase destination
) {
41 throw new RuntimeException("ConstantConverter should be used one-way only");