Interface ParameterValue
public interface ParameterValue
Represents a parameter and its value.
This used for field comparison algorithms and decision tree node comparison functions.
Code Sample
public class CustomMatchingUserServiceSample
implements UserService<TableViewEntitySelection> {
public void setupDisplay(
UserServiceSetupDisplayContext<TableViewEntitySelection> context,
UserServiceDisplayConfigurator configurator) {
Session session = context.getSession();
AdaptationTable table = context.getEntitySelection().getTable();
MatchingOperations matchingOperations = OperationsFactory
.getMatchingOperations(session);
// execute evaluate matching between two records that using a
// matching policy with the code 'matchingPolicyCode'
Adaptation record1 = table
.lookupAdaptationByPrimaryKey(PrimaryKey.parseString("1"));
Adaptation record2 = table
.lookupAdaptationByPrimaryKey(PrimaryKey.parseString("2"));
EvaluateMatchingResult evaluateMatchingResult = matchingOperations
.evaluateMatching(record1, record2, "matchingPolicyCode");
// gets and traverses decision tree nodes in the decision
// from the root node to the last node
Iterator<DecisionNode> decisionNodes =
evaluationMatchingResult
.getDecisionNodes().iterator();
if (decisionNodes.hasNext()) {
DecisionNode rootNode = decisionNodes.next();
List<ParameterValue> parameters = rootNode
.getComparisonFunctionParameters();
Integer minimumScore = parameters
.stream()
.filter(p -> p.getName().equals("minimumScore"))
.findFirst()
.map(p -> p.getValue(p.getValueType()));
}
}
}
-
Method Details
-
getName
String getName()Gets the parameter's name.- Returns:
- String The name of the parameter.
-
getStringValue
String getStringValue()Gets the string representation of the parameter's value.- Returns:
- String The string representation of the parameter's value.
-
getValue
Gets the parameter's value.- Parameters:
type- the parameter's type- Returns:
- X the parameter's value
- Throws:
IllegalArgumentException- if the input is null, or the parameter's value cannot be assigned to the specified type
-
getValueType
Class<?> getValueType()Gets the parameter type's class.- Returns:
- Class The class of the parameter type.
-