@JsonIgnore static Dependency maven(String id) { return from(Type.MAVEN, id); }
@JsonIgnore default boolean isOfType(Type type) { return type.equals(getType()); }
@JsonIgnore default boolean isMaven() { return isOfType(Type.MAVEN); }
@Override default List<Dependency> getDependencies() { final String gav = getDescriptor().getCamelConnectorGAV(); return StringUtils.isEmpty(gav) ? Collections.emptyList() : Collections.singletonList(Dependency.maven(gav)); }
return dependencies.stream() .flatMap(dep -> { if (dep.isExtensionTag()) { List<Extension> extensions = this.loadExtensionsByTag(dep.getId()); Stream<Dependency> extensionDependency = extensions.stream().map(ext -> Dependency.extension(ext.getExtensionId())); Stream<Dependency> transitive = extensions.stream().map(Extension::getDependencies).flatMap(Collection::stream); return Stream.concat(extensionDependency, transitive);
/** * Fill a builder with attribute values from the provided {@code Dependency} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Dependency.Builder createFrom(Dependency instance) { Objects.requireNonNull(instance, "instance"); Dependency.Type typeValue = instance.getType(); if (typeValue != null) { type(typeValue); } String idValue = instance.getId(); if (idValue != null) { id(idValue); } return (Dependency.Builder) this; }
.id("my-extension-1") .extensionId("my-extension-1") .addDependency(Dependency.maven("org.slf4j:slf4j-api:1.7.11")) .addDependency(Dependency.maven("org.slf4j:slf4j-simple:1.7.11")) .addDependency(Dependency.maven("org.apache.camel:camel-spring-boot-starter:2.10.0")) .build()) .putConfiguredProperty("key-1", "val-1")
.build()) .putConfiguredProperty("template", template) .addDependency(Dependency.maven("org.apache.camel:camel-mustache:2.21.0.fuse-720007")) .build(), new Step.Builder()
@JsonIgnore static Dependency extension(String id) { return from(Type.EXTENSION, id); }
@JsonIgnore default boolean isExtension() { return isOfType(Type.EXTENSION); }
@JsonIgnore static Dependency libraryTag(String id) { return from(Type.EXTENSION_TAG, id); }
@JsonIgnore default boolean isExtensionTag() { return isOfType(Type.EXTENSION_TAG); }