Package eu.maveniverse.domtrip.maven
Class AlignOptions
- java.lang.Object
-
- eu.maveniverse.domtrip.maven.AlignOptions
-
public final class AlignOptions extends java.lang.ObjectOptions for controlling how dependencies are aligned with project conventions.When adding or aligning dependencies, these options specify the version management style, version source, and property naming convention. Null values indicate auto-detection from existing POM conventions.
Usage Examples:
// Auto-detect all conventions AlignOptions options = AlignOptions.defaults(); // Force managed + property style AlignOptions options = AlignOptions.builder() .versionStyle(AlignOptions.VersionStyle.MANAGED) .versionSource(AlignOptions.VersionSource.PROPERTY) .build(); // Force specific property name AlignOptions options = AlignOptions.builder() .versionSource(AlignOptions.VersionSource.PROPERTY) .propertyName("junit.version") .build(); // Custom property naming pattern AlignOptions options = AlignOptions.builder() .versionSource(AlignOptions.VersionSource.PROPERTY) .propertyNameGenerator(coords -> coords.groupId() + "." + coords.artifactId() + ".version") .build(); // Add with scope AlignOptions options = AlignOptions.builder() .scope("test") .build();- Since:
- 1.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAlignOptions.BuilderBuilder forAlignOptions.static classAlignOptions.PropertyNamingConventionNaming convention for version properties.static classAlignOptions.VersionSourceWhether the version value is a literal or a property reference.static classAlignOptions.VersionStyleWhether the dependency version is inline or delegated to dependency management.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AlignOptions.Builderbuilder()Create a new Builder for constructing AlignOptions.static AlignOptionsdefaults()Create an AlignOptions instance with all conventions set to auto-detect.static java.lang.StringgeneratePropertyName(Coordinates coords, AlignOptions.PropertyNamingConvention convention)Generates a version property name for the given coordinates and naming convention.AlignOptions.PropertyNamingConventionnamingConvention()The property naming convention to use, or null to indicate auto-detection.java.lang.StringpropertyName()Provides the explicit property name override.java.util.function.Function<Coordinates,java.lang.String>propertyNameGenerator()Custom function that generates property names from dependency coordinates, or null to use convention-based generation.java.lang.Stringscope()Get the Maven dependency scope configured for this instance.AlignOptions.VersionSourceversionSource()The configured version source, or null to indicate auto-detection.AlignOptions.VersionStyleversionStyle()Gets the configured version placement style or defers to auto-detection when unspecified.
-
-
-
Method Detail
-
defaults
public static AlignOptions defaults()
Create an AlignOptions instance with all conventions set to auto-detect.- Returns:
- an AlignOptions whose fields are all
null, indicating auto-detection of conventions - Since:
- 1.1.0
-
builder
public static AlignOptions.Builder builder()
Create a new Builder for constructing AlignOptions.- Returns:
- a new Builder instance for configuring and building an AlignOptions object
- Since:
- 1.1.0
-
versionStyle
public AlignOptions.VersionStyle versionStyle()
Gets the configured version placement style or defers to auto-detection when unspecified.- Returns:
- the configured version style, or
nullto indicate auto-detection - Since:
- 1.1.0
-
versionSource
public AlignOptions.VersionSource versionSource()
The configured version source, or null to indicate auto-detection.- Returns:
- the version source override, or
nullif auto-detection is used - Since:
- 1.1.0
-
namingConvention
public AlignOptions.PropertyNamingConvention namingConvention()
The property naming convention to use, or null to indicate auto-detection.- Returns:
- the naming convention override, or
nullif it should be auto-detected - Since:
- 1.1.0
-
propertyNameGenerator
public java.util.function.Function<Coordinates,java.lang.String> propertyNameGenerator()
Custom function that generates property names from dependency coordinates, or null to use convention-based generation.When provided, this function is used to derive property names allowing arbitrary naming patterns beyond the built-in
AlignOptions.PropertyNamingConventionoptions.Precedence: an explicit property name overrides this generator, which overrides an explicit naming convention, which in turn falls back to auto-detection.
- Returns:
- the property name generator, or null
- Since:
- 1.1.0
-
propertyName
public java.lang.String propertyName()
Provides the explicit property name override.- Returns:
- the explicit property name override, or
nullto indicate auto-generation - Since:
- 1.1.0
-
scope
public java.lang.String scope()
Get the Maven dependency scope configured for this instance.May be
nullto indicate the default scope.- Returns:
- the dependency scope (e.g., "test", "provided"), or
nullto use the default - Since:
- 1.1.0
-
generatePropertyName
public static java.lang.String generatePropertyName(Coordinates coords, AlignOptions.PropertyNamingConvention convention)
Generates a version property name for the given coordinates and naming convention.Examples:
DOT_SUFFIX:junit-jupiter.versionDASH_SUFFIX:junit-jupiter-versionCAMEL_CASE:junitJupiterVersionDOT_PREFIX:version.junit-jupiter
- Parameters:
coords- the dependency coordinates (artifactId is used as the base name)convention- the naming convention to apply- Returns:
- the generated property name
- Since:
- 1.1.0
-
-