/** * merge all the possible matches, if the values implement Mergeable then a full merge is done * @param orderedMatches * @return */ private T merge(final List<Match<T>> orderedMatches) { T actualMatch = null; for (Match<T> match : orderedMatches) { if (actualMatch == null || !Mergeable.class.isAssignableFrom(actualMatch.getClass())) { actualMatch = match.getValue(); if (!Mergeable.class.isAssignableFrom(actualMatch.getClass())) { break; } } else { ((Mergeable)actualMatch).merge(match.getValue()); } } return actualMatch; }
/** * merge all the possible matches, if the values implement Mergeable then a full merge is done * @param orderedMatches * @return */ private T merge(final Collection<Match<T>> orderedMatches) { T actualMatch = null; for (Match<T> match : orderedMatches) { if (actualMatch == null || !Mergeable.class.isAssignableFrom(actualMatch.getClass())) { actualMatch = match.getValue(); if (!Mergeable.class.isAssignableFrom(actualMatch.getClass())) { break; } } else { ((Mergeable)actualMatch).merge(match.getValue()); } } return actualMatch; }