boolean (ConfigurationFromContext self, ConfigurationFromContext other) { FakeRunConfiguration selfConfig = ObjectUtils.tryCast(self.getConfiguration(), FakeRunConfiguration.class); FakeRunConfiguration otherConfig = ObjectUtils.tryCast(other.getConfiguration(), FakeRunConfiguration.class); if (selfConfig == null || otherConfig == null) { return false; } if (SORTING == SortingMode.NAME_ASC) { return selfConfig.getName().compareTo(otherConfig.getName()) < 0; } if (SORTING == SortingMode.NAME_DESC) { return selfConfig.getName().compareTo(otherConfig.getName()) > 0; } return false; }