Source:
<code>private void validateMetadataKeyId(ExtensionModel extensionModel, ComponentModel model, MetadataResolverFactory resolverFactory, ProblemsReporter problemsReporter) { final String modelTypeName = capitalize(getComponentModelTypeName(model)); Optional<MetadataKeyIdModelProperty> keyId = model.getModelProperty(MetadataKeyIdModelProperty.class); if (keyId.isPresent()) { if (resolverFactory.getOutputResolver() instanceof NullMetadataResolver && !thereIsAnInputTypeResolverDefined(getAllInputResolvers(model, resolverFactory)) <START> && isCompileTime(extensionModel)) { <END> problemsReporter.addError(new Problem(model, format("%s '%s' defines a MetadataKeyId parameter but neither" + " an Output nor Type resolver that makes use of it was defined", modelTypeName, model.getName()))); } keyId.get().getType().accept(new MetadataTypeVisitor() { public void visitObject(ObjectType objectType) { List<ParameterModel> parts = model.getAllParameterModels().stream() .filter(p -> p.getModelProperty(MetadataKeyPartModelProperty.class).isPresent()).collect(toList()); List<ParameterModel> defaultParts = parts.stream().filter(p -> p.getDefaultValue() != null).collect(toList()); if (!defaultParts.isEmpty() && defaultParts.size() != parts.size()) { String typeName = ExtensionMetadataTypeUtils.getId(objectType).orElse("Anonymous type"); problemsReporter .addError(new Problem(model, format("%s '%s' uses the multilevel key of type '%s', which defines '%s' MetadataKeyPart with default values, but the type contains '%s' " + "MetadataKeyParts. All the annotated MetadataKeyParts should have a default value if at least one part " + "has a default value. Either add the missing defaults or remove all of them.", modelTypeName, model.getName(), typeName, defaultParts.size(), parts.size()))); } } }); } else { if (!(resolverFactory.getKeyResolver() instanceof NullMetadataResolver)) { problemsReporter.addError(new Problem(model, format("%s '%s' does not define a MetadataKeyId parameter but " + "a TypeKeysResolver of type '%s' was associated to it.", modelTypeName, model.getName(), resolverFactory.getKeyResolver().getClass().getName()))); } } }</code><technical_language>this condition mule startup unnecessary processing</technical_language>

Target:
private void validateMetadataKeyId(ExtensionModel extensionModel, ComponentModel model, MetadataResolverFactory resolverFactory, ProblemsReporter problemsReporter) { final String modelTypeName = capitalize(getComponentModelTypeName(model)); Optional<MetadataKeyIdModelProperty> keyId = model.getModelProperty(MetadataKeyIdModelProperty.class); if (keyId.isPresent()) { if (isCompileTime(extensionModel) && resolverFactory.getOutputResolver() instanceof NullMetadataResolver && !thereIsAnInputTypeResolverDefined(getAllInputResolvers(model, resolverFactory))) { problemsReporter.addError(new Problem(model, format("%s '%s' defines a MetadataKeyId parameter but neither" + " an Output nor Type resolver that makes use of it was defined", modelTypeName, model.getName()))); } keyId.get().getType().accept(new MetadataTypeVisitor() { public void visitObject(ObjectType objectType) { List<ParameterModel> parts = model.getAllParameterModels().stream() .filter(p -> p.getModelProperty(MetadataKeyPartModelProperty.class).isPresent()).collect(toList()); List<ParameterModel> defaultParts = parts.stream().filter(p -> p.getDefaultValue() != null).collect(toList()); if (!defaultParts.isEmpty() && defaultParts.size() != parts.size()) { String typeName = ExtensionMetadataTypeUtils.getId(objectType).orElse("Anonymous type"); problemsReporter .addError(new Problem(model, format("%s '%s' uses the multilevel key of type '%s', which defines '%s' MetadataKeyPart with default values, but the type contains '%s' " + "MetadataKeyParts. All the annotated MetadataKeyParts should have a default value if at least one part " + "has a default value. Either add the missing defaults or remove all of them.", modelTypeName, model.getName(), typeName, defaultParts.size(), parts.size()))); } } }); } else { if (!(resolverFactory.getKeyResolver() instanceof NullMetadataResolver)) { problemsReporter.addError(new Problem(model, format("%s '%s' does not define a MetadataKeyId parameter but " + "a TypeKeysResolver of type '%s' was associated to it.", modelTypeName, model.getName(), resolverFactory.getKeyResolver().getClass().getName()))); } } }