
io.mosip.authentication.common.service.impl.match.EmailMatchingStrategy Maven / Gradle / Ivy
package io.mosip.authentication.common.service.impl.match;
import java.util.Map;
import io.mosip.authentication.core.spi.indauth.match.MatchFunction;
import io.mosip.authentication.core.spi.indauth.match.MatchingStrategyType;
import io.mosip.authentication.core.spi.indauth.match.TextMatchingStrategy;
import io.mosip.authentication.core.util.DemoMatcherUtil;
/**
* The Enum EmailMatchingStrategy - used to compare and
* evaluate the EMAIL value received from the request and entity
*
* @author Sanjay Murali
* @author Nagarjuna
*/
public enum EmailMatchingStrategy implements TextMatchingStrategy {
EXACT(MatchingStrategyType.EXACT, (Object reqInfo, Object entityInfo, Map props) -> {
if (reqInfo instanceof String && entityInfo instanceof String) {
return getDemoMatcherUtilObject(props).doExactMatch((String) reqInfo, (String) entityInfo);
} else {
return 0;
}
});
/** The match function. */
private final MatchFunction matchFunction;
/** The match strategy type. */
private final MatchingStrategyType matchStrategyType;
/**
* Instantiates a new email matching strategy.
*
* @param matchStrategyType the match strategy type
* @param matchFunction the match function
*/
private EmailMatchingStrategy(MatchingStrategyType matchStrategyType, MatchFunction matchFunction) {
this.matchFunction = matchFunction;
this.matchStrategyType = matchStrategyType;
}
/* (non-Javadoc)
* @see io.mosip.authentication.core.spi.indauth.match.MatchingStrategy#getType()
*/
@Override
public MatchingStrategyType getType() {
return matchStrategyType;
}
/* (non-Javadoc)
* @see io.mosip.authentication.core.spi.indauth.match.MatchingStrategy#getMatchFunction()
*/
@Override
public MatchFunction getMatchFunction() {
return matchFunction;
}
/**
* Gets the demoMatcherUtil object
* @param props
* @return
*/
public static DemoMatcherUtil getDemoMatcherUtilObject(Map props) {
return (DemoMatcherUtil)props.get("demoMatcherUtil");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy