Skip to content

Commit

Permalink
MapAndEncryptFunc can extend AbstractPseudoFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaar, Bjørn-Andre committed Mar 13, 2024
1 parent 32672c2 commit 051e44c
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.ssb.dapla.dlp.pseudo.func.composite;

import no.ssb.dapla.dlp.pseudo.func.AbstractPseudoFunc;
import no.ssb.dapla.dlp.pseudo.func.PseudoFunc;
import no.ssb.dapla.dlp.pseudo.func.PseudoFuncConfig;
import no.ssb.dapla.dlp.pseudo.func.PseudoFuncFactory;
Expand All @@ -24,12 +25,13 @@
* The {@code PseudoFuncConfig} must also contain all the necessary configs for each of the underlying
* {@code PseudoFunc}s. For example MapFuncConfig and TinkFpeFuncConfig.
*/
public class MapAndEncryptFunc implements PseudoFunc {
public class MapAndEncryptFunc extends AbstractPseudoFunc {

final PseudoFunc encryptionFunc;
final PseudoFunc mapFunc;

public MapAndEncryptFunc(PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
genericConfig.add(PseudoFuncConfig.Param.FUNC_IMPL,
genericConfig.getRequired(ENCRYPTION_FUNC_IMPL, String.class));
var encryptionFuncConfig = genericConfig.asMap();
Expand All @@ -41,11 +43,6 @@ public MapAndEncryptFunc(PseudoFuncConfig genericConfig) {
this.mapFunc = PseudoFuncFactory.create(new PseudoFuncConfig(mapFuncConfig));
}

@Override
public String getFuncDecl() {
return encryptionFunc.getFuncDecl() + ", " + mapFunc.getFuncDecl();
}

@Override
public String getAlgorithm() {
return encryptionFunc.getAlgorithm();
Expand Down

0 comments on commit 051e44c

Please sign in to comment.