Merge branch '1.5.x' into 2.0.x

This commit is contained in:
Stephane Nicoll
2018-05-02 15:59:56 +02:00
2 changed files with 18 additions and 2 deletions

View File

@@ -145,8 +145,8 @@ public class ConfigurationMetadata {
}
private ItemMetadata findMatchingItemMetadata(ItemMetadata metadata) {
List<ItemMetadata> candidates = this.items.get(metadata.getName());
if (candidates == null || candidates.isEmpty()) {
List<ItemMetadata> candidates = getCandidates(metadata.getName());
if (candidates.isEmpty()) {
return null;
}
candidates.removeIf((itemMetadata) -> !itemMetadata.hasSameType(metadata));
@@ -161,6 +161,11 @@ public class ConfigurationMetadata {
return null;
}
private List<ItemMetadata> getCandidates(String name) {
List<ItemMetadata> candidates = this.items.get(name);
return (candidates != null ? new ArrayList<>(candidates) : new ArrayList<>());
}
private boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;