private static String describeMapFunction(final MapFunction mapFunction) { return mapFunction.accept(new MapFunctionVisitor<String>() { @Override public String visit(Decrease function) { return function.getClass().getSimpleName(); } @Override public String visit(Identity function) { return function.getClass().getSimpleName(); } @Override public String visit(Ignore function) { return function.getClass().getSimpleName(); } @Override public String visit(Increase function) { return function.getClass().getSimpleName(); } @Override public String visit(SetTo function) { return String.format("%s (%s)", function.getClass().getSimpleName(), function.getStatus().getLabel()); } }); } }
if (newStatus.isGreaterThan(MIN_SEVERITY)) { mappedStatus = edge.getMapFunction().map(newStatus).orElse(MIN_SEVERITY); } else { mappedStatus = newStatus;
public AbstractMapFunctionEntity toPersistenceFunction(MapFunction mapFunction) { AbstractMapFunctionEntity mapFunctionEntity = mapFunction.accept(serviceToPersistenceMapping); if (mapFunctionEntity == null) { throw new IllegalArgumentException("No mapping found"); } return mapFunctionEntity; }
try { final MapFunction mapFunction = ((Class<? extends MapFunction>) m_mapFunctionSelect.getValue()).newInstance(); mapFunction.accept(new MapFunctionVisitor<Void>() { @Override public Void visit(Decrease decrease) {
try { final MapFunction mapFunction = ((Class<? extends MapFunction>) m_mapFunctionSelect.getValue()).newInstance(); mapFunction.accept(new MapFunctionVisitor<Void>() { @Override public Void visit(Decrease decrease) {
m_mapFunctionSelect.setValue(edge.getMapFunction().getClass()); edge.getMapFunction().accept(new MapFunctionVisitor<Void>() { @Override public Void visit(Decrease decrease) {
m_mapFunctionSelect.setValue(edge.getMapFunction().getClass()); edge.getMapFunction().accept(new MapFunctionVisitor<Void>() { @Override public Void visit(Decrease decrease) {