INNER CODE UNIT · Java
newMetricDefinition
SeaseLtd/rated-ranking-evaluator · rre-core/src/main/java/io/sease/rre/Func.java:92
public static Class<? extends Metric> newMetricDefinition(final String clazzName) {
try {
return (Class<? extends Metric>) Class.forName(clazzName);
} catch (final Exception exception) {
throw new IllegalArgumentException(exception);
}
}
/**
* Returns the (child) node which declares the gain/rating associated with a given document.
*
* @param owner the owner (relevant) document.
* @return the (child) node which declares the gain/rating associated with a given document.
*/
public static Optional<JsonNode> gainOrRatingNode(final JsonNode owner) {
return ofNullable(ofNullable(owner.get(GAIN)).orElse(owner.get(RATING)));
}
}