[MNG-7601] Reformat sources

This commit is contained in:
Guillaume Nodet 2022-11-22 11:21:12 +01:00
parent 49572e46c9
commit de19cfcd2b
1278 changed files with 48062 additions and 67004 deletions

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@ -18,7 +17,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@ -100,6 +98,19 @@ under the License.
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>${distributionFileName}</finalName>
<pluginManagement>
@ -179,10 +190,10 @@ under the License.
<executions>
<execution>
<id>create-distro-packages</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
@ -194,19 +205,6 @@ under the License.
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>create-distribution-in-dir</id>
@ -222,10 +220,10 @@ under the License.
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-target-dir</id>
<goals>
<goal>clean</goal>
</goals>
<id>clean-target-dir</id>
<phase>prepare-package</phase>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
@ -243,10 +241,10 @@ under the License.
<executions>
<execution>
<id>create-distribution-dir</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<finalName>./</finalName>
<appendAssemblyId>false</appendAssemblyId>
@ -271,10 +269,10 @@ under the License.
<executions>
<execution>
<id>make-src-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/assembly/src.xml</descriptor>
@ -288,14 +286,6 @@ under the License.
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<executions>
<execution>
<id>source-release-checksum</id>
<goals>
<goal>files</goal>
</goals>
</execution>
</executions>
<configuration>
<fileSets>
<fileSet>
@ -310,6 +300,14 @@ under the License.
</fileSets>
<failIfNoFiles>true</failIfNoFiles>
</configuration>
<executions>
<execution>
<id>source-release-checksum</id>
<goals>
<goal>files</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -1,5 +1,3 @@
package org.apache.maven.settings;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,39 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.settings;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import org.apache.maven.settings.v4.SettingsXpp3Reader;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests that the global settings.xml shipped with the distribution is in good state.
*
* @author Benjamin Bentmann
*/
public class GlobalSettingsTest
{
public class GlobalSettingsTest {
@Test
public void testValidGlobalSettings()
throws Exception
{
String basedir = System.getProperty( "basedir", System.getProperty( "user.dir" ) );
public void testValidGlobalSettings() throws Exception {
String basedir = System.getProperty("basedir", System.getProperty("user.dir"));
File globalSettingsFile = new File( basedir, "src/assembly/maven/conf/settings.xml" );
assertTrue( globalSettingsFile.isFile(), globalSettingsFile.getAbsolutePath() );
File globalSettingsFile = new File(basedir, "src/assembly/maven/conf/settings.xml");
assertTrue(globalSettingsFile.isFile(), globalSettingsFile.getAbsolutePath());
try ( Reader reader = new InputStreamReader( new FileInputStream( globalSettingsFile ), StandardCharsets.UTF_8) )
{
new SettingsXpp3Reader().read( reader );
try (Reader reader = new InputStreamReader(new FileInputStream(globalSettingsFile), StandardCharsets.UTF_8)) {
new SettingsXpp3Reader().read(reader);
}
}
}

View File

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -30,8 +29,7 @@
*/
@Experimental
@Immutable
public interface Artifact
{
public interface Artifact {
/**
* Returns a unique identifier for this artifact.
@ -39,13 +37,15 @@ public interface Artifact
*
* @return the unique identifier
*/
default String key()
{
default String key() {
return getGroupId()
+ ':' + getArtifactId()
+ ':' + getExtension()
+ ( getClassifier().length() > 0 ? ":" + getClassifier() : "" )
+ ':' + getVersion();
+ ':'
+ getArtifactId()
+ ':'
+ getExtension()
+ (getClassifier().length() > 0 ? ":" + getClassifier() : "")
+ ':'
+ getVersion();
}
/**
@ -104,5 +104,4 @@ default String key()
*/
@Nonnull
ArtifactCoordinate toCoordinate();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -31,8 +30,7 @@
*/
@Experimental
@Immutable
public interface ArtifactCoordinate
{
public interface ArtifactCoordinate {
/**
* The groupId of the artifact.
@ -77,13 +75,11 @@ public interface ArtifactCoordinate
/**
* Unique id identifying this artifact
*/
default String getId()
{
default String getId() {
return getGroupId()
+ ":" + getArtifactId()
+ ":" + getExtension()
+ ( getClassifier().isEmpty() ? "" : ":" + getClassifier() )
+ (getClassifier().isEmpty() ? "" : ":" + getClassifier())
+ ":" + getVersion();
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Nonnull;
public interface Dependency extends Artifact
{
public interface Dependency extends Artifact {
/**
* The artifact type.
@ -44,5 +42,4 @@ public interface Dependency extends Artifact
*/
@Nonnull
DependencyCoordinate toCoordinate();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.annotations.Immutable;
package org.apache.maven.api;
import java.util.Collection;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.Nullable;
/**
*
@ -32,8 +30,7 @@
*/
@Experimental
@Immutable
public interface DependencyCoordinate extends ArtifactCoordinate
{
public interface DependencyCoordinate extends ArtifactCoordinate {
/**
* The type of the artifact.
*
@ -50,5 +47,4 @@ public interface DependencyCoordinate extends ArtifactCoordinate
@Nonnull
Collection<Exclusion> getExclusions();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api;
import java.util.Optional;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* Event sent by maven during various phases of the build process.
@ -32,8 +30,7 @@
* @since 4.0
*/
@Experimental
public interface Event
{
public interface Event {
/**
* Gets the type of the event.
@ -73,5 +70,4 @@ public interface Event
* @return the exception or {@code empty()} if none
*/
Optional<Exception> getException();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
@ -27,8 +26,7 @@
* @since 4.0
*/
@Experimental
public enum EventType
{
public enum EventType {
PROJECT_DISCOVERY_STARTED,
SESSION_STARTED,
SESSION_ENDED,

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nullable;
@ -29,12 +28,10 @@
* @see DependencyCoordinate#getExclusions()
*/
@Experimental
public interface Exclusion
{
public interface Exclusion {
@Nullable
String getGroupId();
@Nullable
String getArtifactId();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
@ -27,9 +26,7 @@
* @since 4.0
*/
@Experimental
public interface JavaToolchain extends Toolchain
{
public interface JavaToolchain extends Toolchain {
String getJavaHome();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;
@ -30,8 +29,8 @@
* @since 4.0
*/
@Experimental
@FunctionalInterface @Consumer
public interface Listener
{
void onEvent( @Nonnull Event event );
@FunctionalInterface
@Consumer
public interface Listener {
void onEvent(@Nonnull Event event);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.nio.file.Path;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
@ -33,10 +31,8 @@
*/
@Experimental
@Immutable
public interface LocalRepository extends Repository
{
public interface LocalRepository extends Repository {
@Nonnull
Path getPath();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
@ -27,8 +26,7 @@
* @since 4.0
*/
@Experimental
public enum MetadataStorage
{
public enum MetadataStorage {
GROUP,
ARTIFACT,
VERSION

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,12 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.util.Optional;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.model.Plugin;
import org.apache.maven.api.xml.Dom;
@ -31,8 +28,7 @@
* A {@code MojoExecution}
*/
@Experimental
public interface MojoExecution
{
public interface MojoExecution {
@Nonnull
Plugin getPlugin();

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
/**
* Represents a dependency node within a Maven project's dependency collector.
@ -36,8 +34,7 @@
*/
@Experimental
@Immutable
public interface Node
{
public interface Node {
/**
* @return dependency for this node
@ -70,7 +67,7 @@ public interface Node
* @param visitor the visitor to call back, must not be {@code null}
* @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings
*/
boolean accept( @Nonnull NodeVisitor visitor );
boolean accept(@Nonnull NodeVisitor visitor);
/**
* Returns a new tree starting at this node, filtering the children.
@ -80,7 +77,7 @@ public interface Node
* @param filter the filter to apply
* @return a new filtered graph
*/
Node filter( Predicate<Node> filter );
Node filter(Predicate<Node> filter);
/**
* Returns a string representation of this dependency node.
@ -95,9 +92,7 @@ public interface Node
* @return a stream containing this node and its descendant
*/
@Nonnull
default Stream<Node> stream()
{
return Stream.concat( Stream.of( this ), getChildren().stream().flatMap( Node::stream ) );
default Stream<Node> stream() {
return Stream.concat(Stream.of(this), getChildren().stream().flatMap(Node::stream));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;
@ -31,8 +29,7 @@
*/
@Experimental
@Consumer
public interface NodeVisitor
{
public interface NodeVisitor {
/**
* Starts the visit to the specified dependency node.
*
@ -40,7 +37,7 @@ public interface NodeVisitor
* @return <code>true</code> to visit the specified dependency node's children, <code>false</code> to skip the
* specified dependency node's children and proceed to its next sibling
*/
boolean enter( @Nonnull Node node );
boolean enter(@Nonnull Node node);
/**
* Ends the visit to the specified dependency node.
@ -49,5 +46,5 @@ public interface NodeVisitor
* @return <code>true</code> to visit the specified dependency node's next sibling, <code>false</code> to skip the
* specified dependency node's next siblings and proceed to its parent
*/
boolean leave( @Nonnull Node node );
boolean leave(@Nonnull Node node);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.model.Build;
@ -35,8 +33,7 @@
* @since 4.0
*/
@Experimental
public interface Project
{
public interface Project {
@Nonnull
String getGroupId();
@ -57,8 +54,7 @@ public interface Project
Model getModel();
@Nonnull
default Build getBuild()
{
default Build getBuild() {
Build build = getModel().getBuild();
return build != null ? build : Build.newInstance();
}
@ -74,9 +70,8 @@ default Build getBuild()
Optional<Path> getPomPath();
@Nonnull
default Optional<Path> getBasedir()
{
return getPomPath().map( Path::getParent );
default Optional<Path> getBasedir() {
return getPomPath().map(Path::getParent);
}
@Nonnull
@ -86,8 +81,7 @@ default Optional<Path> getBasedir()
List<DependencyCoordinate> getManagedDependencies();
@Nonnull
default String getId()
{
default String getId() {
return getModel().getId();
}
@ -101,5 +95,4 @@ default String getId()
@Nonnull
List<RemoteRepository> getRemotePluginRepositories();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -28,13 +27,11 @@
*/
@Experimental
@Immutable
public interface RemoteRepository extends Repository
{
public interface RemoteRepository extends Repository {
@Nonnull
String getUrl();
@Nonnull
String getProtocol();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -32,8 +31,7 @@
*/
@Experimental
@Immutable
public interface Repository
{
public interface Repository {
/**
* Gets the identifier of this repository.
@ -50,5 +48,4 @@ public interface Repository
*/
@Nonnull
String getType();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.util.Arrays;
import java.util.Collections;
@ -27,7 +26,6 @@
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.api.annotations.Experimental;
/**
@ -40,65 +38,59 @@
* @since 4.0
*/
@Experimental
public enum ResolutionScope
{
public enum ResolutionScope {
/**
* empty resolution scope
*/
NONE( null ),
NONE(null),
/**
* <code>compile</code> resolution scope
* = <code>compile</code> + <code>system</code> + <code>provided</code> dependencies
*/
COMPILE( "compile", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED ),
COMPILE("compile", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED),
/**
* <code>compile+runtime</code> resolution scope (Maven 3 only)
* = <code>compile</code> + <code>system</code> + <code>provided</code> + <code>runtime</code> dependencies
*/
COMPILE_PLUS_RUNTIME( "compile+runtime", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME ),
COMPILE_PLUS_RUNTIME("compile+runtime", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME),
/**
* <code>runtime</code> resolution scope
* = <code>compile</code> + <code>runtime</code> dependencies
*/
RUNTIME( "runtime", Scope.COMPILE, Scope.RUNTIME ),
RUNTIME("runtime", Scope.COMPILE, Scope.RUNTIME),
/**
* <code>runtime+system</code> resolution scope (Maven 3 only)
* = <code>compile</code> + <code>system</code> + <code>runtime</code> dependencies
*/
RUNTIME_PLUS_SYSTEM( "runtime+system", Scope.COMPILE, Scope.SYSTEM, Scope.RUNTIME ),
RUNTIME_PLUS_SYSTEM("runtime+system", Scope.COMPILE, Scope.SYSTEM, Scope.RUNTIME),
/**
* <code>test</code> resolution scope
* = <code>compile</code> + <code>system</code> + <code>provided</code> + <code>runtime</code> + <code>test</code>
* dependencies
*/
TEST( "test", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME, Scope.TEST );
TEST("test", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME, Scope.TEST);
private static final Map<String, ResolutionScope> VALUES
= Stream.of( ResolutionScope.values() ).collect( Collectors.toMap( ResolutionScope::id, s -> s ) );
private static final Map<String, ResolutionScope> VALUES =
Stream.of(ResolutionScope.values()).collect(Collectors.toMap(ResolutionScope::id, s -> s));
public static ResolutionScope fromString( String id )
{
return Optional.ofNullable( VALUES.get( id ) )
.orElseThrow( () -> new IllegalArgumentException( "Unknown resolution scope " + id ) );
public static ResolutionScope fromString(String id) {
return Optional.ofNullable(VALUES.get(id))
.orElseThrow(() -> new IllegalArgumentException("Unknown resolution scope " + id));
}
private final String id;
private final Set<Scope> scopes;
ResolutionScope( String id, Scope... scopes )
{
ResolutionScope(String id, Scope... scopes) {
this.id = id;
this.scopes = Collections.unmodifiableSet( new HashSet<>( Arrays.asList( scopes ) ) );
this.scopes = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(scopes)));
}
public String id()
{
public String id() {
return this.id;
}
public Set<Scope> scopes()
{
public Set<Scope> scopes() {
return scopes;
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.util.Locale;
import org.apache.maven.api.annotations.Experimental;
/**
@ -29,29 +27,25 @@
* @since 4.0
*/
@Experimental
public enum Scope
{
COMPILE( "compile" ),
PROVIDED ( "provided" ),
SYSTEM( "system" ),
RUNTIME( "runtime" ),
TEST( "test" ),
IMPORT( "import" );
public enum Scope {
COMPILE("compile"),
PROVIDED("provided"),
SYSTEM("system"),
RUNTIME("runtime"),
TEST("test"),
IMPORT("import");
private final String id;
Scope( String id )
{
Scope(String id) {
this.id = id;
}
public String id()
{
public String id() {
return this.id;
}
public static Scope get( String scope )
{
return Enum.valueOf( Scope.class, scope.toUpperCase( Locale.ROOT ) );
public static Scope get(String scope) {
return Enum.valueOf(Scope.class, scope.toUpperCase(Locale.ROOT));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.ThreadSafe;
@ -32,6 +31,4 @@
*/
@Experimental
@ThreadSafe
public interface Service
{
}
public interface Service {}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.nio.file.Path;
import java.time.Instant;
@ -26,7 +25,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.ThreadSafe;
@ -41,8 +39,7 @@
*/
@Experimental
@ThreadSafe
public interface Session
{
public interface Session {
@Nonnull
Settings getSettings();
@ -105,7 +102,7 @@ public interface Session
* @throws org.apache.maven.api.services.MavenException if not called from the within a mojo execution
*/
@Nonnull
Map<String, Object> getPluginContext( @Nonnull Project project );
Map<String, Object> getPluginContext(@Nonnull Project project);
/**
* Retrieves the service for the interface
@ -113,7 +110,7 @@ public interface Session
* @throws NoSuchElementException if the service could not be found
*/
@Nonnull
<T extends Service> T getService( @Nonnull Class<T> clazz );
<T extends Service> T getService(@Nonnull Class<T> clazz);
/**
* Creates a derived session using the given local repository.
@ -123,7 +120,7 @@ public interface Session
* @throws NullPointerException if {@code localRepository} is null
*/
@Nonnull
Session withLocalRepository( @Nonnull LocalRepository localRepository );
Session withLocalRepository(@Nonnull LocalRepository localRepository);
/**
* Creates a derived session using the given remote repositories.
@ -133,7 +130,7 @@ public interface Session
* @throws NullPointerException if {@code repositories} is null
*/
@Nonnull
Session withRemoteRepositories( @Nonnull List<RemoteRepository> repositories );
Session withRemoteRepositories(@Nonnull List<RemoteRepository> repositories);
/**
* Register the given listener which will receive all events.
@ -141,7 +138,7 @@ public interface Session
* @param listener the listener to register
* @throws NullPointerException if {@code listener} is null
*/
void registerListener( @Nonnull Listener listener );
void registerListener(@Nonnull Listener listener);
/**
* Unregisters a previously registered listener.
@ -149,7 +146,7 @@ public interface Session
* @param listener the listener to unregister
* @throws NullPointerException if {@code listener} is null
*/
void unregisterListener( @Nonnull Listener listener );
void unregisterListener(@Nonnull Listener listener);
/**
* Returns the list of registered listeners.
@ -163,60 +160,60 @@ public interface Session
* Shortcut for <code>getService(RepositoryFactory.class).createLocal(...)</code>
* @see org.apache.maven.api.services.RepositoryFactory#createLocal(Path)
*/
LocalRepository createLocalRepository( Path path );
LocalRepository createLocalRepository(Path path);
/**
* Shortcut for <code>getService(RepositoryFactory.class).createRemote(...)</code>
* @see org.apache.maven.api.services.RepositoryFactory#createRemote(String, String)
*/
@Nonnull
RemoteRepository createRemoteRepository( @Nonnull String id, @Nonnull String url );
RemoteRepository createRemoteRepository(@Nonnull String id, @Nonnull String url);
/**
* Shortcut for <code>getService(RepositoryFactory.class).createRemote(...)</code>
* @see org.apache.maven.api.services.RepositoryFactory#createRemote(Repository)
*/
@Nonnull
RemoteRepository createRemoteRepository( @Nonnull Repository repository );
RemoteRepository createRemoteRepository(@Nonnull Repository repository);
/**
* Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
* @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String)
*/
ArtifactCoordinate createArtifactCoordinate( String groupId, String artifactId, String version, String extension );
ArtifactCoordinate createArtifactCoordinate(String groupId, String artifactId, String version, String extension);
/**
* Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
* @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
*/
ArtifactCoordinate createArtifactCoordinate( String groupId, String artifactId, String version, String classifier,
String extension, String type );
ArtifactCoordinate createArtifactCoordinate(
String groupId, String artifactId, String version, String classifier, String extension, String type);
/**
* Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
* @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
*/
ArtifactCoordinate createArtifactCoordinate( Artifact artifact );
ArtifactCoordinate createArtifactCoordinate(Artifact artifact);
/**
* Shortcut for <code>getService(DependencyFactory.class).create(...)</code>
* @see DependencyCoordinateFactory#create(Session, ArtifactCoordinate)
*/
@Nonnull
DependencyCoordinate createDependencyCoordinate( @Nonnull ArtifactCoordinate coordinate );
DependencyCoordinate createDependencyCoordinate(@Nonnull ArtifactCoordinate coordinate);
/**
* Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
* @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String)
*/
Artifact createArtifact( String groupId, String artifactId, String version, String extension );
Artifact createArtifact(String groupId, String artifactId, String version, String extension);
/**
* Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
* @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
*/
Artifact createArtifact( String groupId, String artifactId, String version, String classifier,
String extension, String type );
Artifact createArtifact(
String groupId, String artifactId, String version, String classifier, String extension, String type);
/**
* Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
@ -224,7 +221,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
*/
Artifact resolveArtifact( ArtifactCoordinate coordinate );
Artifact resolveArtifact(ArtifactCoordinate coordinate);
/**
* Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
@ -232,7 +229,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
*/
Collection<Artifact> resolveArtifacts( ArtifactCoordinate... coordinates );
Collection<Artifact> resolveArtifacts(ArtifactCoordinate... coordinates);
/**
* Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
@ -240,7 +237,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
*/
Collection<Artifact> resolveArtifacts( Collection<? extends ArtifactCoordinate> coordinates );
Collection<Artifact> resolveArtifacts(Collection<? extends ArtifactCoordinate> coordinates);
/**
* Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
@ -248,7 +245,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
*/
Artifact resolveArtifact( Artifact artifact );
Artifact resolveArtifact(Artifact artifact);
/**
* Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
@ -256,7 +253,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
*/
Collection<Artifact> resolveArtifacts( Artifact... artifacts );
Collection<Artifact> resolveArtifacts(Artifact... artifacts);
/**
* Shortcut for {@code getService(ArtifactInstaller.class).install(...)}
@ -264,7 +261,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
*/
void installArtifacts( Artifact... artifacts );
void installArtifacts(Artifact... artifacts);
/**
* Shortcut for {@code getService(ArtifactInstaller.class).install(...)}
@ -272,7 +269,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
*/
void installArtifacts( Collection<Artifact> artifacts );
void installArtifacts(Collection<Artifact> artifacts);
/**
* Shortcut for <code>getService(ArtifactDeployer.class).deploy(...)</code>
@ -280,26 +277,26 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
*
* @throws org.apache.maven.api.services.ArtifactDeployerException if the artifacts deployment failed
*/
void deployArtifact( RemoteRepository repository, Artifact... artifacts );
void deployArtifact(RemoteRepository repository, Artifact... artifacts);
/**
* Shortcut for <code>getService(ArtifactManager.class).setPath(...)</code>
* @see org.apache.maven.api.services.ArtifactManager#setPath(Artifact, Path)
*/
void setArtifactPath( @Nonnull Artifact artifact, @Nonnull Path path );
void setArtifactPath(@Nonnull Artifact artifact, @Nonnull Path path);
/**
* Shortcut for <code>getService(ArtifactManager.class).getPath(...)</code>
* @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
*/
@Nonnull
Optional<Path> getArtifactPath( @Nonnull Artifact artifact );
Optional<Path> getArtifactPath(@Nonnull Artifact artifact);
/**
* Shortcut for <code>getService(ArtifactManager.class).isSnapshot(...)</code>
* @see org.apache.maven.api.services.VersionParser#isSnapshot(String)
*/
boolean isVersionSnapshot( @Nonnull String version );
boolean isVersionSnapshot(@Nonnull String version);
/**
* Shortcut for <code>getService(DependencyCollector.class).collect(...)</code>
@ -308,7 +305,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
* @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
*/
@Nonnull
Node collectDependencies( @Nonnull Artifact artifact );
Node collectDependencies(@Nonnull Artifact artifact);
/**
* Shortcut for <code>getService(DependencyCollector.class).collect(...)</code>
@ -317,7 +314,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
* @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
*/
@Nonnull
Node collectDependencies( @Nonnull Project project );
Node collectDependencies(@Nonnull Project project);
/**
* Shortcut for <code>getService(DependencyResolver.class).resolve(...)</code>
@ -326,11 +323,11 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
* @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
*/
@Nonnull
Node collectDependencies( @Nonnull DependencyCoordinate dependency );
Node collectDependencies(@Nonnull DependencyCoordinate dependency);
Path getPathForLocalArtifact( @Nonnull Artifact artifact );
Path getPathForLocalArtifact(@Nonnull Artifact artifact);
Path getPathForRemoteArtifact( RemoteRepository remote, Artifact artifact );
Path getPathForRemoteArtifact(RemoteRepository remote, Artifact artifact);
/**
* Shortcut for <code>getService(VersionParser.class).parseVersion(...)</code>
@ -339,7 +336,7 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
* @throws org.apache.maven.api.services.VersionParserException if the parsing failed
*/
@Nonnull
Version parseVersion( @Nonnull String version );
Version parseVersion(@Nonnull String version);
/**
* Shortcut for <code>getService(VersionParser.class).parseVersionRange(...)</code>
@ -348,5 +345,5 @@ Artifact createArtifact( String groupId, String artifactId, String version, Stri
* @throws org.apache.maven.api.services.VersionParserException if the parsing failed
*/
@Nonnull
VersionRange parseVersionRange( @Nonnull String versionRange );
VersionRange parseVersionRange(@Nonnull String versionRange);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.util.function.Supplier;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.annotations.Provider;
import org.apache.maven.api.annotations.ThreadSafe;
import java.util.function.Supplier;
/**
* A container for data that is specific to a session.
* All components may use this storage to associate arbitrary data with a session.
@ -40,9 +38,9 @@
* @since 4.0
*/
@Experimental
@ThreadSafe @Provider
public interface SessionData
{
@ThreadSafe
@Provider
public interface SessionData {
/**
* Associates the specified session data with the given key.
@ -50,7 +48,7 @@ public interface SessionData
* @param key the key under which to store the session data, must not be {@code null}
* @param value the data to associate with the key, may be {@code null} to remove the mapping
*/
void set( @Nonnull Object key, @Nullable Object value );
void set(@Nonnull Object key, @Nullable Object value);
/**
* Associates the specified session data with the given key if the key is currently mapped to the given value. This
@ -62,7 +60,7 @@ public interface SessionData
* @return {@code true} if the key mapping was successfully updated from the old value to the new value,
* {@code false} if the current key mapping didn't match the expected value and was not updated.
*/
boolean set( @Nonnull Object key, @Nullable Object oldValue, @Nullable Object newValue );
boolean set(@Nonnull Object key, @Nullable Object oldValue, @Nullable Object newValue);
/**
* Gets the session data associated with the specified key.
@ -71,7 +69,7 @@ public interface SessionData
* @return the session data associated with the key or {@code null} if none
*/
@Nullable
Object get( @Nonnull Object key );
Object get(@Nonnull Object key);
/**
* Retrieve of compute the data associated with the specified key.
@ -81,6 +79,5 @@ public interface SessionData
* @return the session data associated with the key
*/
@Nullable
Object computeIfAbsent( @Nonnull Object key, @Nonnull Supplier<Object> supplier );
Object computeIfAbsent(@Nonnull Object key, @Nonnull Supplier<Object> supplier);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import java.util.Map;
import org.apache.maven.api.annotations.Experimental;
/**
@ -29,8 +27,7 @@
* @since 4.0
*/
@Experimental
public interface Toolchain
{
public interface Toolchain {
/**
* get the type of toolchain.
*
@ -44,7 +41,7 @@ public interface Toolchain
* @param toolName the tool platform independent tool name
* @return file representing the tool executable, or null if the tool cannot be found
*/
String findTool( String toolName );
String findTool(String toolName);
/**
* Let the toolchain decide if it matches requirements defined
@ -52,5 +49,5 @@ public interface Toolchain
* @param requirements Map&lt;String, String&gt; key value pair, may not be {@code null}
* @return {@code true} if the requirements match, otherwise {@code false}
*/
boolean matchesRequirements( Map<String, String> requirements );
boolean matchesRequirements(Map<String, String> requirements);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -34,8 +33,7 @@
*/
@Experimental
@Immutable
public interface Type
{
public interface Type {
String POM = "pom";
String JAR = "jar";
@ -68,5 +66,4 @@ public interface Type
boolean isIncludesDependencies();
boolean isAddedToClasspath();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
@ -30,9 +29,7 @@
* @see org.apache.maven.api.Session#parseVersion(String)
*/
@Experimental
public interface Version
extends Comparable<Version>
{
public interface Version extends Comparable<Version> {
// TODO: add access to the version information
@ -42,5 +39,4 @@ public interface Version
*/
@Nonnull
String asString();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
@ -28,8 +27,7 @@
* @since 4.0
*/
@Experimental
public interface VersionRange
{
public interface VersionRange {
// TODO: add access to the version information
@ -39,7 +37,7 @@ public interface VersionRange
* @param version the version to test, must not be {@code null}
* @return {@code true} if this range contains the specified version, {@code false} otherwise
*/
boolean contains( @Nonnull Version version );
boolean contains(@Nonnull Version version);
/**
* Returns a string representation of this version range

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin;
import java.util.function.Supplier;
@ -31,8 +30,7 @@
*
* @since 4.0
*/
public interface Log
{
public interface Log {
/**
* @return true if the <b>debug</b> error level is enabled
*/
@ -43,7 +41,7 @@ public interface Log
*
* @param content
*/
void debug( CharSequence content );
void debug(CharSequence content);
/**
* Send a message (and accompanying exception) to the user in the <b>debug</b> error level.<br>
@ -52,7 +50,7 @@ public interface Log
* @param content
* @param error
*/
void debug( CharSequence content, Throwable error );
void debug(CharSequence content, Throwable error);
/**
* Send an exception to the user in the <b>debug</b> error level.<br>
@ -60,11 +58,11 @@ public interface Log
*
* @param error
*/
void debug( Throwable error );
void debug(Throwable error);
void debug( Supplier<String> content );
void debug(Supplier<String> content);
void debug( Supplier<String> content, Throwable error );
void debug(Supplier<String> content, Throwable error);
/**
* @return true if the <b>info</b> error level is enabled
@ -76,7 +74,7 @@ public interface Log
*
* @param content
*/
void info( CharSequence content );
void info(CharSequence content);
/**
* Send a message (and accompanying exception) to the user in the <b>info</b> error level.<br>
@ -85,7 +83,7 @@ public interface Log
* @param content
* @param error
*/
void info( CharSequence content, Throwable error );
void info(CharSequence content, Throwable error);
/**
* Send an exception to the user in the <b>info</b> error level.<br>
@ -93,11 +91,11 @@ public interface Log
*
* @param error
*/
void info( Throwable error );
void info(Throwable error);
void info( Supplier<String> content );
void info(Supplier<String> content);
void info( Supplier<String> content, Throwable error );
void info(Supplier<String> content, Throwable error);
/**
* @return true if the <b>warn</b> error level is enabled
@ -109,7 +107,7 @@ public interface Log
*
* @param content
*/
void warn( CharSequence content );
void warn(CharSequence content);
/**
* Send a message (and accompanying exception) to the user in the <b>warn</b> error level.<br>
@ -118,7 +116,7 @@ public interface Log
* @param content
* @param error
*/
void warn( CharSequence content, Throwable error );
void warn(CharSequence content, Throwable error);
/**
* Send an exception to the user in the <b>warn</b> error level.<br>
@ -126,11 +124,11 @@ public interface Log
*
* @param error
*/
void warn( Throwable error );
void warn(Throwable error);
void warn( Supplier<String> content );
void warn(Supplier<String> content);
void warn( Supplier<String> content, Throwable error );
void warn(Supplier<String> content, Throwable error);
/**
* @return true if the <b>error</b> error level is enabled
@ -142,7 +140,7 @@ public interface Log
*
* @param content
*/
void error( CharSequence content );
void error(CharSequence content);
/**
* Send a message (and accompanying exception) to the user in the <b>error</b> error level.<br>
@ -151,7 +149,7 @@ public interface Log
* @param content
* @param error
*/
void error( CharSequence content, Throwable error );
void error(CharSequence content, Throwable error);
/**
* Send an exception to the user in the <b>error</b> error level.<br>
@ -159,10 +157,9 @@ public interface Log
*
* @param error
*/
void error( Throwable error );
void error(Throwable error);
void error( Supplier<String> content );
void error( Supplier<String> content, Throwable error );
void error(Supplier<String> content);
void error(Supplier<String> content, Throwable error);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;
@ -31,9 +30,9 @@
* @since 4.0
*/
@Experimental
@FunctionalInterface @Consumer
public interface Mojo
{
@FunctionalInterface
@Consumer
public interface Mojo {
/**
* Perform whatever build-process behavior this <code>Mojo</code> implements.<br>
* This is the main trigger for the <code>Mojo</code> inside the <code>Maven</code> system, and allows
@ -42,5 +41,4 @@ public interface Mojo
* @throws MojoException if a problem occurs
*/
void execute();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.services.MavenException;
@ -28,9 +27,7 @@
* @since 4.0
*/
@Experimental
public class MojoException
extends MavenException
{
public class MojoException extends MavenException {
protected Object source;
@ -40,9 +37,8 @@ public class MojoException
* Construct a new <code>MojoException</code> exception providing the source and a short and long message:
* these messages are used to improve the message written at the end of Maven build.
*/
public MojoException( Object source, String shortMessage, String longMessage )
{
super( shortMessage );
public MojoException(Object source, String shortMessage, String longMessage) {
super(shortMessage);
this.source = source;
this.longMessage = longMessage;
}
@ -51,17 +47,15 @@ public MojoException( Object source, String shortMessage, String longMessage )
* Construct a new <code>MojoExecutionException</code> exception wrapping an underlying <code>Throwable</code>
* and providing a <code>message</code>.
*/
public MojoException( String message, Throwable cause )
{
super( message, cause );
public MojoException(String message, Throwable cause) {
super(message, cause);
}
/**
* Construct a new <code>MojoExecutionException</code> exception providing a <code>message</code>.
*/
public MojoException( String message )
{
super( message );
public MojoException(String message) {
super(message);
}
/**
@ -70,19 +64,15 @@ public MojoException( String message )
* @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
* A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
*/
public MojoException( Throwable cause )
{
super( cause );
public MojoException(Throwable cause) {
super(cause);
}
public String getLongMessage()
{
public String getLongMessage() {
return longMessage;
}
public Object getSource()
{
public Object getSource() {
return source;
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -25,7 +24,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.maven.api.annotations.Experimental;
/**
@ -37,11 +35,10 @@
*/
@Experimental
@Documented
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER } )
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Inherited
public @interface Component
{
public @interface Component {
/**
* role of the component to inject.
* @return the role

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -25,7 +24,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.maven.api.annotations.Experimental;
/**
@ -35,11 +33,10 @@
*/
@Experimental
@Documented
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.TYPE )
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
@Inherited
public @interface Execute
{
public @interface Execute {
/**
* Lifecycle phase to fork. Note that specifying a phase overrides specifying a goal.
* For custom lifecycle phase ids use {@link #customPhase()} instead.

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import org.apache.maven.api.annotations.Experimental;
@ -27,22 +26,19 @@
* @since 4.0
*/
@Experimental
public enum InstantiationStrategy
{
PER_LOOKUP( "per-lookup" ),
SINGLETON( "singleton" ),
KEEP_ALIVE( "keep-alive" ),
POOLABLE( "poolable" );
public enum InstantiationStrategy {
PER_LOOKUP("per-lookup"),
SINGLETON("singleton"),
KEEP_ALIVE("keep-alive"),
POOLABLE("poolable");
private final String id;
InstantiationStrategy( String id )
{
InstantiationStrategy(String id) {
this.id = id;
}
public String id()
{
public String id() {
return this.id;
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import org.apache.maven.api.annotations.Experimental;
@ -27,54 +26,49 @@
* @since 4.0
*/
@Experimental
public enum LifecyclePhase
{
public enum LifecyclePhase {
VALIDATE("validate"),
INITIALIZE("initialize"),
GENERATE_SOURCES("generate-sources"),
PROCESS_SOURCES("process-sources"),
GENERATE_RESOURCES("generate-resources"),
PROCESS_RESOURCES("process-resources"),
COMPILE("compile"),
PROCESS_CLASSES("process-classes"),
GENERATE_TEST_SOURCES("generate-test-sources"),
PROCESS_TEST_SOURCES("process-test-sources"),
GENERATE_TEST_RESOURCES("generate-test-resources"),
PROCESS_TEST_RESOURCES("process-test-resources"),
TEST_COMPILE("test-compile"),
PROCESS_TEST_CLASSES("process-test-classes"),
TEST("test"),
PREPARE_PACKAGE("prepare-package"),
PACKAGE("package"),
PRE_INTEGRATION_TEST("pre-integration-test"),
INTEGRATION_TEST("integration-test"),
POST_INTEGRATION_TEST("post-integration-test"),
VERIFY("verify"),
INSTALL("install"),
DEPLOY("deploy"),
VALIDATE( "validate" ),
INITIALIZE( "initialize" ),
GENERATE_SOURCES( "generate-sources" ),
PROCESS_SOURCES( "process-sources" ),
GENERATE_RESOURCES( "generate-resources" ),
PROCESS_RESOURCES( "process-resources" ),
COMPILE( "compile" ),
PROCESS_CLASSES( "process-classes" ),
GENERATE_TEST_SOURCES( "generate-test-sources" ),
PROCESS_TEST_SOURCES( "process-test-sources" ),
GENERATE_TEST_RESOURCES( "generate-test-resources" ),
PROCESS_TEST_RESOURCES( "process-test-resources" ),
TEST_COMPILE( "test-compile" ),
PROCESS_TEST_CLASSES( "process-test-classes" ),
TEST( "test" ),
PREPARE_PACKAGE( "prepare-package" ),
PACKAGE( "package" ),
PRE_INTEGRATION_TEST( "pre-integration-test" ),
INTEGRATION_TEST( "integration-test" ),
POST_INTEGRATION_TEST( "post-integration-test" ),
VERIFY( "verify" ),
INSTALL( "install" ),
DEPLOY( "deploy" ),
PRE_CLEAN("pre-clean"),
CLEAN("clean"),
POST_CLEAN("post-clean"),
PRE_CLEAN( "pre-clean" ),
CLEAN( "clean" ),
POST_CLEAN( "post-clean" ),
PRE_SITE("pre-site"),
SITE("site"),
POST_SITE("post-site"),
SITE_DEPLOY("site-deploy"),
PRE_SITE( "pre-site" ),
SITE( "site" ),
POST_SITE( "post-site" ),
SITE_DEPLOY( "site-deploy" ),
NONE( "" );
NONE("");
private final String id;
LifecyclePhase( String id )
{
LifecyclePhase(String id) {
this.id = id;
}
public String id()
{
public String id() {
return this.id;
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -25,7 +24,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.maven.api.ResolutionScope;
import org.apache.maven.api.annotations.Experimental;
@ -36,11 +34,10 @@
*/
@Experimental
@Documented
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.TYPE )
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
@Inherited
public @interface Mojo
{
public @interface Mojo {
/**
* goal name (required).
* @return the goal name
@ -94,5 +91,4 @@
* @return the configurator bean name
*/
String configurator() default "";
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.plugin.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -25,7 +24,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.maven.api.annotations.Experimental;
/**
@ -41,11 +39,10 @@
*/
@Experimental
@Documented
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.FIELD, ElementType.METHOD } )
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.FIELD, ElementType.METHOD})
@Inherited
public @interface Parameter
{
public @interface Parameter {
/**
* name of the bean property used to get/set the field: by default, field name is used.
* @return the name of the bean property

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.ArtifactCoordinate;
@ -32,8 +31,7 @@
* @since 4.0
*/
@Experimental
public interface ArtifactCoordinateFactory extends Service
{
public interface ArtifactCoordinateFactory extends Service {
/**
* Creates a coordinate.
@ -43,29 +41,36 @@ public interface ArtifactCoordinateFactory extends Service
* @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
*/
@Nonnull
ArtifactCoordinate create( @Nonnull ArtifactCoordinateFactoryRequest request );
ArtifactCoordinate create(@Nonnull ArtifactCoordinateFactoryRequest request);
@Nonnull
default ArtifactCoordinate create( @Nonnull Session session, String groupId,
String artifactId, String version, String extension )
{
return create( ArtifactCoordinateFactoryRequest.build( session, groupId, artifactId, version, extension ) );
default ArtifactCoordinate create(
@Nonnull Session session, String groupId, String artifactId, String version, String extension) {
return create(ArtifactCoordinateFactoryRequest.build(session, groupId, artifactId, version, extension));
}
@Nonnull
default ArtifactCoordinate create( @Nonnull Session session, String groupId, String artifactId, String version,
String classifier, String extension, String type )
{
return create( ArtifactCoordinateFactoryRequest.build( session, groupId, artifactId,
version, classifier, extension, type ) );
default ArtifactCoordinate create(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
return create(ArtifactCoordinateFactoryRequest.build(
session, groupId, artifactId, version, classifier, extension, type));
}
@Nonnull
default ArtifactCoordinate create( @Nonnull Session session, Artifact artifact )
{
return create( ArtifactCoordinateFactoryRequest.build( session,
artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion().asString(),
artifact.getClassifier(), artifact.getExtension(), null ) );
default ArtifactCoordinate create(@Nonnull Session session, Artifact artifact) {
return create(ArtifactCoordinateFactoryRequest.build(
session,
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion().asString(),
artifact.getClassifier(),
artifact.getExtension(),
null));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Session;
@ -26,8 +27,6 @@
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* A request for creating a {@link ArtifactCoordinate} object.
*
@ -35,8 +34,7 @@
*/
@Experimental
@Immutable
public interface ArtifactCoordinateFactoryRequest
{
public interface ArtifactCoordinateFactoryRequest {
@Nonnull
Session getSession();
@ -54,55 +52,55 @@ public interface ArtifactCoordinateFactoryRequest
String getType();
@Nonnull
static ArtifactCoordinateFactoryRequest build( @Nonnull Session session, String groupId, String artifactId,
String version, String extension )
{
static ArtifactCoordinateFactoryRequest build(
@Nonnull Session session, String groupId, String artifactId, String version, String extension) {
return ArtifactCoordinateFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( groupId )
.artifactId( artifactId )
.version( version )
.extension( extension )
.session(nonNull(session, "session cannot be null"))
.groupId(groupId)
.artifactId(artifactId)
.version(version)
.extension(extension)
.build();
}
@Nonnull
static ArtifactCoordinateFactoryRequest build( @Nonnull Session session, String groupId, String artifactId,
String version, String classifier, String extension, String type )
{
static ArtifactCoordinateFactoryRequest build(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
return ArtifactCoordinateFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( groupId )
.artifactId( artifactId )
.version( version )
.classifier( classifier )
.extension( extension )
.type( type )
.session(nonNull(session, "session cannot be null"))
.groupId(groupId)
.artifactId(artifactId)
.version(version)
.classifier(classifier)
.extension(extension)
.type(type)
.build();
}
@Nonnull
static ArtifactCoordinateFactoryRequest build( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
{
static ArtifactCoordinateFactoryRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinate coordinate) {
return ArtifactCoordinateFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( nonNull( coordinate, "coordinate cannot be null" ).getGroupId() )
.artifactId( coordinate.getArtifactId() )
.classifier( coordinate.getClassifier() )
.version( coordinate.getVersion().asString() )
.extension( coordinate.getExtension() )
.session(nonNull(session, "session cannot be null"))
.groupId(nonNull(coordinate, "coordinate cannot be null").getGroupId())
.artifactId(coordinate.getArtifactId())
.classifier(coordinate.getClassifier())
.version(coordinate.getVersion().asString())
.extension(coordinate.getExtension())
.build();
}
static ArtifactFactoryRequestBuilder builder()
{
static ArtifactFactoryRequestBuilder builder() {
return new ArtifactFactoryRequestBuilder();
}
@NotThreadSafe
class ArtifactFactoryRequestBuilder
{
class ArtifactFactoryRequestBuilder {
private Session session;
private String groupId;
private String artifactId;
@ -111,61 +109,50 @@ class ArtifactFactoryRequestBuilder
private String extension;
private String type;
ArtifactFactoryRequestBuilder()
{
}
ArtifactFactoryRequestBuilder() {}
public ArtifactFactoryRequestBuilder session( Session session )
{
public ArtifactFactoryRequestBuilder session(Session session) {
this.session = session;
return this;
}
public ArtifactFactoryRequestBuilder groupId( String groupId )
{
public ArtifactFactoryRequestBuilder groupId(String groupId) {
this.groupId = groupId;
return this;
}
public ArtifactFactoryRequestBuilder artifactId( String artifactId )
{
public ArtifactFactoryRequestBuilder artifactId(String artifactId) {
this.artifactId = artifactId;
return this;
}
public ArtifactFactoryRequestBuilder version( String version )
{
public ArtifactFactoryRequestBuilder version(String version) {
this.version = version;
return this;
}
public ArtifactFactoryRequestBuilder classifier( String classifier )
{
public ArtifactFactoryRequestBuilder classifier(String classifier) {
this.classifier = classifier;
return this;
}
public ArtifactFactoryRequestBuilder extension( String extension )
{
public ArtifactFactoryRequestBuilder extension(String extension) {
this.extension = extension;
return this;
}
public ArtifactFactoryRequestBuilder type( String type )
{
public ArtifactFactoryRequestBuilder type(String type) {
this.type = type;
return this;
}
public ArtifactCoordinateFactoryRequest build()
{
return new DefaultArtifactFactoryRequestArtifact( session, groupId, artifactId, version,
classifier, extension, type );
public ArtifactCoordinateFactoryRequest build() {
return new DefaultArtifactFactoryRequestArtifact(
session, groupId, artifactId, version, classifier, extension, type);
}
private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest implements
ArtifactCoordinateFactoryRequest
{
private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest
implements ArtifactCoordinateFactoryRequest {
private final String groupId;
private final String artifactId;
private final String version;
@ -173,15 +160,15 @@ private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest i
private final String extension;
private final String type;
DefaultArtifactFactoryRequestArtifact( @Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type )
{
super( session );
DefaultArtifactFactoryRequestArtifact(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
super(session);
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@ -191,41 +178,34 @@ private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest i
}
@Override
public String getGroupId()
{
public String getGroupId() {
return groupId;
}
@Override
public String getArtifactId()
{
public String getArtifactId() {
return artifactId;
}
@Override
public String getVersion()
{
public String getVersion() {
return version;
}
@Override
public String getClassifier()
{
public String getClassifier() {
return classifier;
}
@Override
public String getExtension()
{
public String getExtension() {
return extension;
}
@Override
public String getType()
{
public String getType() {
return type;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.Collection;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.RemoteRepository;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
@ -35,14 +33,13 @@
* @see Session#deployArtifact(RemoteRepository, Artifact...)
*/
@Experimental
public interface ArtifactDeployer extends Service
{
public interface ArtifactDeployer extends Service {
/**
* @param request {@link ArtifactDeployerRequest}
* @throws ArtifactDeployerException if the deployment failed
*/
void deploy( @Nonnull ArtifactDeployerRequest request );
void deploy(@Nonnull ArtifactDeployerRequest request);
/**
* @param session the repository session
@ -51,11 +48,8 @@ public interface ArtifactDeployer extends Service
* @throws ArtifactDeployerException if the deployment failed
* @throws IllegalArgumentException if an argument is {@code null} or invalid
*/
default void deploy( @Nonnull Session session,
@Nonnull RemoteRepository repository,
@Nonnull Collection<Artifact> artifacts )
{
deploy( ArtifactDeployerRequest.build( session, repository, artifacts ) );
default void deploy(
@Nonnull Session session, @Nonnull RemoteRepository repository, @Nonnull Collection<Artifact> artifacts) {
deploy(ArtifactDeployerRequest.build(session, repository, artifacts));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,9 +26,7 @@
* @since 4.0
*/
@Experimental
public class ArtifactDeployerException
extends MavenException
{
public class ArtifactDeployerException extends MavenException {
/**
*
@ -40,9 +37,7 @@ public class ArtifactDeployerException
* @param message the message of the error
* @param e {@link Exception}
*/
public ArtifactDeployerException( String message, Exception e )
{
super( message, e );
public ArtifactDeployerException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.util.Collection;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.RemoteRepository;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import java.util.Collection;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.RemoteRepository;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* A request for deploying one or more artifacts to a remote repository.
*
@ -38,8 +35,7 @@
*/
@Experimental
@Immutable
public interface ArtifactDeployerRequest
{
public interface ArtifactDeployerRequest {
@Nonnull
Session getSession();
@ -53,105 +49,88 @@ public interface ArtifactDeployerRequest
int getRetryFailedDeploymentCount();
@Nonnull
static ArtifactDeployerRequestBuilder builder()
{
static ArtifactDeployerRequestBuilder builder() {
return new ArtifactDeployerRequestBuilder();
}
@Nonnull
static ArtifactDeployerRequest build( @Nonnull Session session,
@Nonnull RemoteRepository repository,
@Nonnull Collection<Artifact> artifacts )
{
static ArtifactDeployerRequest build(
@Nonnull Session session, @Nonnull RemoteRepository repository, @Nonnull Collection<Artifact> artifacts) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.repository( nonNull( repository, "repository cannot be null" ) )
.artifacts( nonNull( artifacts, "artifacts cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.repository(nonNull(repository, "repository cannot be null"))
.artifacts(nonNull(artifacts, "artifacts cannot be null"))
.build();
}
class ArtifactDeployerRequestBuilder
{
class ArtifactDeployerRequestBuilder {
Session session;
RemoteRepository repository;
Collection<Artifact> artifacts;
int retryFailedDeploymentCount;
ArtifactDeployerRequestBuilder()
{
}
ArtifactDeployerRequestBuilder() {}
@Nonnull
public ArtifactDeployerRequestBuilder session( Session session )
{
public ArtifactDeployerRequestBuilder session(Session session) {
this.session = session;
return this;
}
@Nonnull
public ArtifactDeployerRequestBuilder repository( RemoteRepository repository )
{
public ArtifactDeployerRequestBuilder repository(RemoteRepository repository) {
this.repository = repository;
return this;
}
public ArtifactDeployerRequestBuilder artifacts( Collection<Artifact> artifacts )
{
public ArtifactDeployerRequestBuilder artifacts(Collection<Artifact> artifacts) {
this.artifacts = artifacts;
return this;
}
public ArtifactDeployerRequestBuilder retryFailedDeploymentCount( int retryFailedDeploymentCount )
{
public ArtifactDeployerRequestBuilder retryFailedDeploymentCount(int retryFailedDeploymentCount) {
this.retryFailedDeploymentCount = retryFailedDeploymentCount;
return this;
}
@Nonnull
public ArtifactDeployerRequest build()
{
return new DefaultArtifactDeployerRequest( session, repository, artifacts, retryFailedDeploymentCount );
public ArtifactDeployerRequest build() {
return new DefaultArtifactDeployerRequest(session, repository, artifacts, retryFailedDeploymentCount);
}
private static class DefaultArtifactDeployerRequest extends BaseRequest
implements ArtifactDeployerRequest
{
private static class DefaultArtifactDeployerRequest extends BaseRequest implements ArtifactDeployerRequest {
private final RemoteRepository repository;
private final Collection<Artifact> artifacts;
private final int retryFailedDeploymentCount;
DefaultArtifactDeployerRequest( @Nonnull Session session,
@Nonnull RemoteRepository repository,
@Nonnull Collection<Artifact> artifacts,
int retryFailedDeploymentCount )
{
super( session );
this.repository = nonNull( repository, "repository cannot be null" );
this.artifacts = unmodifiable( nonNull( artifacts, "artifacts cannot be null" ) );
DefaultArtifactDeployerRequest(
@Nonnull Session session,
@Nonnull RemoteRepository repository,
@Nonnull Collection<Artifact> artifacts,
int retryFailedDeploymentCount) {
super(session);
this.repository = nonNull(repository, "repository cannot be null");
this.artifacts = unmodifiable(nonNull(artifacts, "artifacts cannot be null"));
this.retryFailedDeploymentCount = retryFailedDeploymentCount;
}
@Nonnull
@Override
public RemoteRepository getRepository()
{
public RemoteRepository getRepository() {
return repository;
}
@Nonnull
@Override
public Collection<Artifact> getArtifacts()
{
public Collection<Artifact> getArtifacts() {
return artifacts;
}
@Override
public int getRetryFailedDeploymentCount()
{
public int getRetryFailedDeploymentCount() {
return retryFailedDeploymentCount;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
@ -31,8 +30,7 @@
* @since 4.0
*/
@Experimental
public interface ArtifactFactory extends Service
{
public interface ArtifactFactory extends Service {
/**
* Creates an artifact.
@ -42,20 +40,23 @@ public interface ArtifactFactory extends Service
* @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
*/
@Nonnull
Artifact create( @Nonnull ArtifactFactoryRequest request );
Artifact create(@Nonnull ArtifactFactoryRequest request);
@Nonnull
default Artifact create( @Nonnull Session session, String groupId,
String artifactId, String version, String extension )
{
return create( ArtifactFactoryRequest.build( session, groupId, artifactId, version, extension ) );
default Artifact create(
@Nonnull Session session, String groupId, String artifactId, String version, String extension) {
return create(ArtifactFactoryRequest.build(session, groupId, artifactId, version, extension));
}
@Nonnull
default Artifact create( @Nonnull Session session, String groupId, String artifactId, String version,
String classifier, String extension, String type )
{
return create( ArtifactFactoryRequest.build( session, groupId, artifactId,
version, classifier, extension, type ) );
default Artifact create(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
return create(ArtifactFactoryRequest.build(session, groupId, artifactId, version, classifier, extension, type));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.NotThreadSafe;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
*
*
@ -35,8 +33,7 @@
*/
@Experimental
@Immutable
public interface ArtifactFactoryRequest
{
public interface ArtifactFactoryRequest {
@Nonnull
Session getSession();
@ -53,40 +50,42 @@ public interface ArtifactFactoryRequest
String getType();
static ArtifactFactoryRequest build( Session session, String groupId, String artifactId,
String version, String extension )
{
static ArtifactFactoryRequest build(
Session session, String groupId, String artifactId, String version, String extension) {
return ArtifactFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( groupId )
.artifactId( artifactId )
.version( version )
.extension( extension )
.session(nonNull(session, "session cannot be null"))
.groupId(groupId)
.artifactId(artifactId)
.version(version)
.extension(extension)
.build();
}
static ArtifactFactoryRequest build( Session session, String groupId, String artifactId,
String version, String classifier, String extension, String type )
{
static ArtifactFactoryRequest build(
Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
return ArtifactFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( groupId )
.artifactId( artifactId )
.version( version )
.classifier( classifier )
.extension( extension )
.type( type )
.session(nonNull(session, "session cannot be null"))
.groupId(groupId)
.artifactId(artifactId)
.version(version)
.classifier(classifier)
.extension(extension)
.type(type)
.build();
}
static ArtifactFactoryRequestBuilder builder()
{
static ArtifactFactoryRequestBuilder builder() {
return new ArtifactFactoryRequestBuilder();
}
@NotThreadSafe
class ArtifactFactoryRequestBuilder
{
class ArtifactFactoryRequestBuilder {
private Session session;
private String groupId;
private String artifactId;
@ -95,60 +94,49 @@ class ArtifactFactoryRequestBuilder
private String extension;
private String type;
ArtifactFactoryRequestBuilder()
{
}
ArtifactFactoryRequestBuilder() {}
public ArtifactFactoryRequestBuilder session( Session session )
{
public ArtifactFactoryRequestBuilder session(Session session) {
this.session = session;
return this;
}
public ArtifactFactoryRequestBuilder groupId( String groupId )
{
public ArtifactFactoryRequestBuilder groupId(String groupId) {
this.groupId = groupId;
return this;
}
public ArtifactFactoryRequestBuilder artifactId( String artifactId )
{
public ArtifactFactoryRequestBuilder artifactId(String artifactId) {
this.artifactId = artifactId;
return this;
}
public ArtifactFactoryRequestBuilder version( String version )
{
public ArtifactFactoryRequestBuilder version(String version) {
this.version = version;
return this;
}
public ArtifactFactoryRequestBuilder classifier( String classifier )
{
public ArtifactFactoryRequestBuilder classifier(String classifier) {
this.classifier = classifier;
return this;
}
public ArtifactFactoryRequestBuilder extension( String extension )
{
public ArtifactFactoryRequestBuilder extension(String extension) {
this.extension = extension;
return this;
}
public ArtifactFactoryRequestBuilder type( String type )
{
public ArtifactFactoryRequestBuilder type(String type) {
this.type = type;
return this;
}
public ArtifactFactoryRequest build()
{
return new DefaultArtifactFactoryRequest( session, groupId, artifactId, version,
classifier, extension, type );
public ArtifactFactoryRequest build() {
return new DefaultArtifactFactoryRequest(
session, groupId, artifactId, version, classifier, extension, type);
}
private static class DefaultArtifactFactoryRequest extends BaseRequest implements ArtifactFactoryRequest
{
private static class DefaultArtifactFactoryRequest extends BaseRequest implements ArtifactFactoryRequest {
private final String groupId;
private final String artifactId;
private final String version;
@ -156,15 +144,15 @@ private static class DefaultArtifactFactoryRequest extends BaseRequest implement
private final String extension;
private final String type;
DefaultArtifactFactoryRequest( @Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type )
{
super( session );
DefaultArtifactFactoryRequest(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
super(session);
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@ -174,41 +162,34 @@ private static class DefaultArtifactFactoryRequest extends BaseRequest implement
}
@Override
public String getGroupId()
{
public String getGroupId() {
return groupId;
}
@Override
public String getArtifactId()
{
public String getArtifactId() {
return artifactId;
}
@Override
public String getVersion()
{
public String getVersion() {
return version;
}
@Override
public String getClassifier()
{
public String getClassifier() {
return classifier;
}
@Override
public String getExtension()
{
public String getExtension() {
return extension;
}
@Override
public String getType()
{
public String getType() {
return type;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.Collection;
import java.util.Collections;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.annotations.Experimental;
/**
@ -34,14 +32,13 @@
* @see Session#withLocalRepository(org.apache.maven.api.LocalRepository)
*/
@Experimental
public interface ArtifactInstaller extends Service
{
public interface ArtifactInstaller extends Service {
/**
* @param request {@link ArtifactInstallerRequest}
* @throws ArtifactInstallerException in case of an error
* @throws IllegalArgumentException in case {@code request} is {@code null}
*/
void install( ArtifactInstallerRequest request );
void install(ArtifactInstallerRequest request);
/**
* @param session the repository session
@ -51,9 +48,8 @@ public interface ArtifactInstaller extends Service
* @throws IllegalArgumentException in case of parameter {@code session} is {@code null} or
* {@code artifact} is {@code null}.
*/
default void install( Session session, Artifact artifact )
{
install( session, Collections.singletonList( artifact ) );
default void install(Session session, Artifact artifact) {
install(session, Collections.singletonList(artifact));
}
/**
@ -66,9 +62,7 @@ default void install( Session session, Artifact artifact )
* or parameter {@code mavenArtifacts} is {@code null} or
* {@code mavenArtifacts.isEmpty()} is {@code true}.
*/
default void install( Session session, Collection<Artifact> artifacts )
{
install( ArtifactInstallerRequest.build( session, artifacts ) );
default void install(Session session, Collection<Artifact> artifacts) {
install(ArtifactInstallerRequest.build(session, artifacts));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -25,9 +24,7 @@
* @since 4.0
*/
@Experimental
public class ArtifactInstallerException
extends MavenException
{
public class ArtifactInstallerException extends MavenException {
/**
*
@ -38,9 +35,7 @@ public class ArtifactInstallerException
* @param message the message of the error
* @param e {@link Exception}
*/
public ArtifactInstallerException( String message, Exception e )
{
super( message, e );
public ArtifactInstallerException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,21 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.util.Collection;
import java.util.Collections;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import org.apache.maven.api.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* A request for installing one or more artifacts in the local repository.
*
@ -40,8 +37,7 @@
*/
@Experimental
@Immutable
public interface ArtifactInstallerRequest
{
public interface ArtifactInstallerRequest {
@Nonnull
Session getSession();
@ -50,70 +46,56 @@ public interface ArtifactInstallerRequest
Collection<Artifact> getArtifacts();
@Nonnull
static ArtifactInstallerRequestBuilder builder()
{
static ArtifactInstallerRequestBuilder builder() {
return new ArtifactInstallerRequestBuilder();
}
@Nonnull
static ArtifactInstallerRequest build( Session session, Collection<Artifact> artifacts )
{
static ArtifactInstallerRequest build(Session session, Collection<Artifact> artifacts) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.artifacts( nonNull( artifacts, "artifacts cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.artifacts(nonNull(artifacts, "artifacts cannot be null"))
.build();
}
@NotThreadSafe
class ArtifactInstallerRequestBuilder
{
class ArtifactInstallerRequestBuilder {
Session session;
Collection<Artifact> artifacts = Collections.emptyList();
ArtifactInstallerRequestBuilder()
{
}
ArtifactInstallerRequestBuilder() {}
@Nonnull
public ArtifactInstallerRequestBuilder session( @Nonnull Session session )
{
public ArtifactInstallerRequestBuilder session(@Nonnull Session session) {
this.session = session;
return this;
}
@Nonnull
public ArtifactInstallerRequestBuilder artifacts( @Nullable Collection<Artifact> artifacts )
{
public ArtifactInstallerRequestBuilder artifacts(@Nullable Collection<Artifact> artifacts) {
this.artifacts = artifacts != null ? artifacts : Collections.emptyList();
return this;
}
@Nonnull
public ArtifactInstallerRequest build()
{
return new DefaultArtifactInstallerRequest( session, artifacts );
public ArtifactInstallerRequest build() {
return new DefaultArtifactInstallerRequest(session, artifacts);
}
static class DefaultArtifactInstallerRequest extends BaseRequest
implements ArtifactInstallerRequest
{
static class DefaultArtifactInstallerRequest extends BaseRequest implements ArtifactInstallerRequest {
private final Collection<Artifact> artifacts;
DefaultArtifactInstallerRequest( @Nonnull Session session,
@Nonnull Collection<Artifact> artifacts )
{
super( session );
this.artifacts = unmodifiable( nonNull( artifacts, "artifacts cannot be null" ) );
DefaultArtifactInstallerRequest(@Nonnull Session session, @Nonnull Collection<Artifact> artifacts) {
super(session);
this.artifacts = unmodifiable(nonNull(artifacts, "artifacts cannot be null"));
}
@Nonnull
@Override
public Collection<Artifact> getArtifacts()
{
public Collection<Artifact> getArtifacts() {
return artifacts;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,34 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api.services;
import java.nio.file.Path;
import java.util.Optional;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
*
* @since 4.0
*/
@Experimental
public interface ArtifactManager extends Service
{
public interface ArtifactManager extends Service {
/**
* Returns the path of the file previously associated to this artifact
* or {@code Optional.empty()} if no path has been associated.
*/
@Nonnull
Optional<Path> getPath( @Nonnull Artifact artifact );
Optional<Path> getPath(@Nonnull Artifact artifact);
/**
* Associates the given file path to the artifact.
*/
void setPath( @Nonnull Artifact artifact, Path path );
void setPath(@Nonnull Artifact artifact, Path path);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.Collection;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
@ -32,8 +30,7 @@
* @since 4.0
*/
@Experimental
public interface ArtifactResolver extends Service
{
public interface ArtifactResolver extends Service {
/**
* @param request {@link ArtifactResolverRequest}
@ -42,7 +39,7 @@ public interface ArtifactResolver extends Service
* @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
* parameter {@code mavenArtifact} is {@code null} or invalid
*/
ArtifactResolverResult resolve( ArtifactResolverRequest request );
ArtifactResolverResult resolve(ArtifactResolverRequest request);
/**
* @param session {@link Session}
@ -52,10 +49,7 @@ public interface ArtifactResolver extends Service
* @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
* parameter {@code coordinate} is {@code null} or invalid
*/
default ArtifactResolverResult resolve( Session session,
Collection<? extends ArtifactCoordinate> coordinates )
{
return resolve( ArtifactResolverRequest.build( session, coordinates ) );
default ArtifactResolverResult resolve(Session session, Collection<? extends ArtifactCoordinate> coordinates) {
return resolve(ArtifactResolverRequest.build(session, coordinates));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,9 +26,7 @@
* @since 4.0
*/
@Experimental
public class ArtifactResolverException
extends MavenException
{
public class ArtifactResolverException extends MavenException {
private static final long serialVersionUID = 7252294837746943917L;
@ -37,9 +34,7 @@ public class ArtifactResolverException
* @param message the message for the exception
* @param e the exception itself
*/
public ArtifactResolverException( String message, Exception e )
{
super( message, e );
public ArtifactResolverException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.util.Collection;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
@ -28,8 +28,6 @@
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* A request for resolving an artifact.
*
@ -37,8 +35,7 @@
*/
@Experimental
@Immutable
public interface ArtifactResolverRequest
{
public interface ArtifactResolverRequest {
@Nonnull
Session getSession();
@ -46,70 +43,58 @@ public interface ArtifactResolverRequest
Collection<? extends ArtifactCoordinate> getCoordinates();
@Nonnull
static ArtifactResolverRequestBuilder builder()
{
static ArtifactResolverRequestBuilder builder() {
return new ArtifactResolverRequestBuilder();
}
@Nonnull
static ArtifactResolverRequest build( @Nonnull Session session,
@Nonnull Collection<? extends ArtifactCoordinate> coordinates )
{
static ArtifactResolverRequest build(
@Nonnull Session session, @Nonnull Collection<? extends ArtifactCoordinate> coordinates) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.coordinates( nonNull( coordinates, "coordinates cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.coordinates(nonNull(coordinates, "coordinates cannot be null"))
.build();
}
@NotThreadSafe
class ArtifactResolverRequestBuilder
{
class ArtifactResolverRequestBuilder {
Session session;
Collection<? extends ArtifactCoordinate> coordinates;
ArtifactResolverRequestBuilder()
{
}
ArtifactResolverRequestBuilder() {}
@Nonnull
public ArtifactResolverRequestBuilder session( Session session )
{
public ArtifactResolverRequestBuilder session(Session session) {
this.session = session;
return this;
}
@Nonnull
public ArtifactResolverRequestBuilder coordinates( Collection<? extends ArtifactCoordinate> coordinates )
{
public ArtifactResolverRequestBuilder coordinates(Collection<? extends ArtifactCoordinate> coordinates) {
this.coordinates = coordinates;
return this;
}
@Nonnull
public ArtifactResolverRequest build()
{
return new DefaultArtifactResolverRequest( session, coordinates );
public ArtifactResolverRequest build() {
return new DefaultArtifactResolverRequest(session, coordinates);
}
private static class DefaultArtifactResolverRequest extends BaseRequest implements ArtifactResolverRequest
{
private static class DefaultArtifactResolverRequest extends BaseRequest implements ArtifactResolverRequest {
@Nonnull
private final Collection<? extends ArtifactCoordinate> coordinates;
DefaultArtifactResolverRequest( @Nonnull Session session,
@Nonnull Collection<? extends ArtifactCoordinate> coordinates )
{
super( session );
this.coordinates = unmodifiable( nonNull( coordinates, "coordinates cannot be null" ) );
DefaultArtifactResolverRequest(
@Nonnull Session session, @Nonnull Collection<? extends ArtifactCoordinate> coordinates) {
super(session);
this.coordinates = unmodifiable(nonNull(coordinates, "coordinates cannot be null"));
}
@Nonnull
@Override
public Collection<? extends ArtifactCoordinate> getCoordinates()
{
public Collection<? extends ArtifactCoordinate> getCoordinates() {
return coordinates;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.nio.file.Path;
import java.util.Map;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
@ -32,12 +30,10 @@
* @since 4.0
*/
@Experimental
public interface ArtifactResolverResult
{
public interface ArtifactResolverResult {
/**
* @return {@link Artifact}
*/
@Nonnull
Map<Artifact, Path> getArtifacts();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,15 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api.services;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* Base class for requests.
@ -34,34 +31,29 @@
* @since 4.0
*/
@Experimental
abstract class BaseRequest
{
abstract class BaseRequest {
private final Session session;
protected BaseRequest( @Nonnull Session session )
{
this.session = nonNull( session, "session cannot be null" );
protected BaseRequest(@Nonnull Session session) {
this.session = nonNull(session, "session cannot be null");
}
@Nonnull
public Session getSession()
{
public Session getSession() {
return session;
}
public static <T> T nonNull( T obj, String message )
{
if ( obj == null )
{
throw new IllegalArgumentException( message );
public static <T> T nonNull(T obj, String message) {
if (obj == null) {
throw new IllegalArgumentException(message);
}
return obj;
}
protected static <T> Collection<T> unmodifiable( Collection<T> obj )
{
protected static <T> Collection<T> unmodifiable(Collection<T> obj) {
return obj != null && !obj.isEmpty()
? Collections.unmodifiableCollection( new ArrayList<>( obj ) ) : Collections.emptyList();
? Collections.unmodifiableCollection(new ArrayList<>(obj))
: Collections.emptyList();
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -32,8 +31,7 @@
*/
@Experimental
@Immutable
public interface BuilderProblem
{
public interface BuilderProblem {
/**
* Gets the hint about the source of the problem. While the syntax of this hint is unspecified and depends on the
@ -102,12 +100,9 @@ public interface BuilderProblem
* @since 4.0
*/
@Experimental
enum Severity
{
enum Severity {
FATAL, //
ERROR, //
WARNING //
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.DependencyCoordinate;
import org.apache.maven.api.Project;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* The DependencyCollector service can be used to collect dependencies
@ -37,8 +35,7 @@
* @since 4.0
*/
@Experimental
public interface DependencyCollector extends Service
{
public interface DependencyCollector extends Service {
/**
* Collects the transitive dependencies and builds a dependency graph.
@ -55,7 +52,7 @@ public interface DependencyCollector extends Service
* @see DependencyCollector#collect(Session, Artifact)
*/
@Nonnull
DependencyCollectorResult collect( @Nonnull DependencyCollectorRequest request );
DependencyCollectorResult collect(@Nonnull DependencyCollectorRequest request);
/**
* Collects the transitive dependencies of some artifacts and builds a dependency graph. Note that this operation is
@ -70,10 +67,8 @@ public interface DependencyCollector extends Service
* @see #collect(DependencyCollectorRequest)
*/
@Nonnull
default DependencyCollectorResult collect( @Nonnull Session session,
@Nonnull DependencyCoordinate root )
{
return collect( DependencyCollectorRequest.build( session, root ) );
default DependencyCollectorResult collect(@Nonnull Session session, @Nonnull DependencyCoordinate root) {
return collect(DependencyCollectorRequest.build(session, root));
}
/**
@ -89,10 +84,8 @@ default DependencyCollectorResult collect( @Nonnull Session session,
* @see #collect(DependencyCollectorRequest)
*/
@Nonnull
default DependencyCollectorResult collect( @Nonnull Session session,
@Nonnull Project project )
{
return collect( DependencyCollectorRequest.build( session, project ) );
default DependencyCollectorResult collect(@Nonnull Session session, @Nonnull Project project) {
return collect(DependencyCollectorRequest.build(session, project));
}
/**
@ -108,10 +101,7 @@ default DependencyCollectorResult collect( @Nonnull Session session,
* @see #collect(DependencyCollectorRequest)
*/
@Nonnull
default DependencyCollectorResult collect( @Nonnull Session session,
@Nonnull Artifact artifact )
{
return collect( DependencyCollectorRequest.build( session, artifact ) );
default DependencyCollectorResult collect(@Nonnull Session session, @Nonnull Artifact artifact) {
return collect(DependencyCollectorRequest.build(session, artifact));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -28,9 +27,7 @@
* @since 4.0
*/
@Experimental
public class DependencyCollectorException
extends MavenException
{
public class DependencyCollectorException extends MavenException {
/**
*
*/
@ -40,8 +37,7 @@ public class DependencyCollectorException
* @param message the message you would give for the exception
* @param cause the cause which is related to the message
*/
public DependencyCollectorException( String message, Throwable cause )
{
super( message, cause );
public DependencyCollectorException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,13 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.DependencyCoordinate;
import org.apache.maven.api.Project;
@ -35,8 +35,6 @@
import org.apache.maven.api.annotations.NotThreadSafe;
import org.apache.maven.api.annotations.Nullable;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* A request to collect the transitive dependencies and to build a dependency graph from them. There are three ways to
* create a dependency graph. First, only the root dependency can be given. Second, a root dependency and direct
@ -49,8 +47,7 @@
*/
@Experimental
@Immutable
public interface DependencyCollectorRequest
{
public interface DependencyCollectorRequest {
@Nonnull
Session getSession();
@ -70,43 +67,38 @@ public interface DependencyCollectorRequest
boolean getVerbose();
@Nonnull
static DependencyCollectorRequest build( @Nonnull Session session, Artifact root )
{
static DependencyCollectorRequest build(@Nonnull Session session, Artifact root) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.rootArtifact( nonNull( root, "root cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.rootArtifact(nonNull(root, "root cannot be null"))
.build();
}
@Nonnull
static DependencyCollectorRequest build( @Nonnull Session session, @Nonnull DependencyCoordinate root )
{
static DependencyCollectorRequest build(@Nonnull Session session, @Nonnull DependencyCoordinate root) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.root( nonNull( root, "root cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.root(nonNull(root, "root cannot be null"))
.build();
}
@Nonnull
static DependencyCollectorRequest build( @Nonnull Session session, @Nonnull Project project )
{
static DependencyCollectorRequest build(@Nonnull Session session, @Nonnull Project project) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.rootArtifact( nonNull( project, "project cannot be null" ).getArtifact() )
.dependencies( project.getDependencies() )
.managedDependencies( project.getManagedDependencies() )
.session(nonNull(session, "session cannot be null"))
.rootArtifact(nonNull(project, "project cannot be null").getArtifact())
.dependencies(project.getDependencies())
.managedDependencies(project.getManagedDependencies())
.build();
}
@Nonnull
static DependencyCollectorRequestBuilder builder()
{
static DependencyCollectorRequestBuilder builder() {
return new DependencyCollectorRequestBuilder();
}
@NotThreadSafe
class DependencyCollectorRequestBuilder
{
class DependencyCollectorRequestBuilder {
Session session;
Artifact rootArtifact;
@ -115,13 +107,10 @@ class DependencyCollectorRequestBuilder
List<DependencyCoordinate> managedDependencies = Collections.emptyList();
boolean verbose;
DependencyCollectorRequestBuilder()
{
}
DependencyCollectorRequestBuilder() {}
@Nonnull
public DependencyCollectorRequestBuilder session( @Nonnull Session session )
{
public DependencyCollectorRequestBuilder session(@Nonnull Session session) {
this.session = session;
return this;
}
@ -138,8 +127,7 @@ public DependencyCollectorRequestBuilder session( @Nonnull Session session )
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder rootArtifact( @Nullable Artifact rootArtifact )
{
public DependencyCollectorRequestBuilder rootArtifact(@Nullable Artifact rootArtifact) {
this.rootArtifact = rootArtifact;
return this;
}
@ -149,8 +137,7 @@ public DependencyCollectorRequestBuilder rootArtifact( @Nullable Artifact rootAr
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder root( @Nonnull DependencyCoordinate root )
{
public DependencyCollectorRequestBuilder root(@Nonnull DependencyCoordinate root) {
this.root = root;
return this;
}
@ -164,9 +151,8 @@ public DependencyCollectorRequestBuilder root( @Nonnull DependencyCoordinate roo
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder dependencies( @Nullable List<DependencyCoordinate> dependencies )
{
this.dependencies = ( dependencies != null ) ? dependencies : Collections.emptyList();
public DependencyCollectorRequestBuilder dependencies(@Nullable List<DependencyCoordinate> dependencies) {
this.dependencies = (dependencies != null) ? dependencies : Collections.emptyList();
return this;
}
@ -177,20 +163,16 @@ public DependencyCollectorRequestBuilder dependencies( @Nullable List<Dependency
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder dependency( @Nullable DependencyCoordinate dependency )
{
if ( dependency != null )
{
if ( this.dependencies.isEmpty() )
{
public DependencyCollectorRequestBuilder dependency(@Nullable DependencyCoordinate dependency) {
if (dependency != null) {
if (this.dependencies.isEmpty()) {
this.dependencies = new ArrayList<>();
}
this.dependencies.add( dependency );
this.dependencies.add(dependency);
}
return this;
}
/**
* Sets the dependency management to apply to transitive dependencies. To clarify, this management does not
* apply to
@ -201,9 +183,8 @@ public DependencyCollectorRequestBuilder dependency( @Nullable DependencyCoordin
*/
@Nonnull
public DependencyCollectorRequestBuilder managedDependencies(
@Nullable List<DependencyCoordinate> managedDependencies )
{
this.managedDependencies = ( managedDependencies != null ) ? managedDependencies : Collections.emptyList();
@Nullable List<DependencyCoordinate> managedDependencies) {
this.managedDependencies = (managedDependencies != null) ? managedDependencies : Collections.emptyList();
return this;
}
@ -215,15 +196,12 @@ public DependencyCollectorRequestBuilder managedDependencies(
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder managedDependency( @Nullable DependencyCoordinate managedDependency )
{
if ( managedDependency != null )
{
if ( this.managedDependencies.isEmpty() )
{
public DependencyCollectorRequestBuilder managedDependency(@Nullable DependencyCoordinate managedDependency) {
if (managedDependency != null) {
if (this.managedDependencies.isEmpty()) {
this.managedDependencies = new ArrayList<>();
}
this.managedDependencies.add( managedDependency );
this.managedDependencies.add(managedDependency);
}
return this;
}
@ -235,34 +213,24 @@ public DependencyCollectorRequestBuilder managedDependency( @Nullable Dependency
* @return this request for chaining, never {@code null}
*/
@Nonnull
public DependencyCollectorRequestBuilder verbose( boolean verbose )
{
public DependencyCollectorRequestBuilder verbose(boolean verbose) {
this.verbose = verbose;
return this;
}
@Nonnull
public DependencyCollectorRequest build()
{
public DependencyCollectorRequest build() {
return new DefaultDependencyCollectorRequest(
session,
rootArtifact,
root,
dependencies,
managedDependencies,
verbose );
session, rootArtifact, root, dependencies, managedDependencies, verbose);
}
static class DefaultDependencyCollectorRequest extends BaseRequest
implements DependencyCollectorRequest
{
static class DefaultDependencyCollectorRequest extends BaseRequest implements DependencyCollectorRequest {
private final Artifact rootArtifact;
private final DependencyCoordinate root;
private final Collection<DependencyCoordinate> dependencies;
private final Collection<DependencyCoordinate> managedDependencies;
private final boolean verbose;
/**
* Creates a request with the specified properties.
*
@ -276,59 +244,50 @@ static class DefaultDependencyCollectorRequest extends BaseRequest
@Nullable DependencyCoordinate root,
@Nonnull Collection<DependencyCoordinate> dependencies,
@Nonnull Collection<DependencyCoordinate> managedDependencies,
boolean verbose )
{
super( session );
boolean verbose) {
super(session);
this.rootArtifact = rootArtifact;
this.root = root;
this.dependencies = unmodifiable( nonNull( dependencies, "dependencies cannot be null" ) );
this.managedDependencies = unmodifiable( nonNull( managedDependencies,
"managedDependencies cannot be null" ) );
this.dependencies = unmodifiable(nonNull(dependencies, "dependencies cannot be null"));
this.managedDependencies =
unmodifiable(nonNull(managedDependencies, "managedDependencies cannot be null"));
this.verbose = verbose;
}
@Nonnull
@Override
public Optional<Artifact> getRootArtifact()
{
return Optional.ofNullable( rootArtifact );
public Optional<Artifact> getRootArtifact() {
return Optional.ofNullable(rootArtifact);
}
@Nonnull
@Override
public Optional<DependencyCoordinate> getRoot()
{
return Optional.ofNullable( root );
public Optional<DependencyCoordinate> getRoot() {
return Optional.ofNullable(root);
}
@Nonnull
@Override
public Collection<DependencyCoordinate> getDependencies()
{
public Collection<DependencyCoordinate> getDependencies() {
return dependencies;
}
@Nonnull
@Override
public Collection<DependencyCoordinate> getManagedDependencies()
{
public Collection<DependencyCoordinate> getManagedDependencies() {
return managedDependencies;
}
@Override
public boolean getVerbose()
{
public boolean getVerbose() {
return verbose;
}
@Nonnull
@Override
public String toString()
{
public String toString() {
return getRoot() + " -> " + getDependencies();
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import org.apache.maven.api.Node;
import org.apache.maven.api.annotations.Experimental;
@ -31,20 +29,18 @@
* @see DependencyCollector#collect(DependencyCollectorRequest)
*/
@Experimental
public interface DependencyCollectorResult
{
/**
* Gets the exceptions that occurred while building the dependency graph.
*
* @return the exceptions that occurred, never {@code null}
*/
List<Exception> getExceptions();
/**
* Gets the root node of the dependency graph.
*
* @return the root node of the dependency graph or {@code null} if none
*/
Node getRoot();
public interface DependencyCollectorResult {
/**
* Gets the exceptions that occurred while building the dependency graph.
*
* @return the exceptions that occurred, never {@code null}
*/
List<Exception> getExceptions();
/**
* Gets the root node of the dependency graph.
*
* @return the root node of the dependency graph or {@code null} if none
*/
Node getRoot();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.DependencyCoordinate;
@ -34,8 +33,7 @@
* @since 4.0
*/
@Experimental
public interface DependencyCoordinateFactory extends Service
{
public interface DependencyCoordinateFactory extends Service {
/**
* Creates a new {@link DependencyCoordinate} object from the request.
@ -47,43 +45,47 @@ public interface DependencyCoordinateFactory extends Service
* if {@code request.getSession()} is null or invalid
*/
@Nonnull
DependencyCoordinate create( @Nonnull DependencyCoordinateFactoryRequest request );
DependencyCoordinate create(@Nonnull DependencyCoordinateFactoryRequest request);
@Nonnull
default DependencyCoordinate create( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
{
return create( DependencyCoordinateFactoryRequest.build( session, coordinate ) );
default DependencyCoordinate create(@Nonnull Session session, @Nonnull ArtifactCoordinate coordinate) {
return create(DependencyCoordinateFactoryRequest.build(session, coordinate));
}
@Nonnull
default DependencyCoordinate create( @Nonnull Session session, @Nonnull org.apache.maven.api.Dependency dependency )
{
return create( DependencyCoordinateFactoryRequest.build( session, dependency ) );
default DependencyCoordinate create(@Nonnull Session session, @Nonnull org.apache.maven.api.Dependency dependency) {
return create(DependencyCoordinateFactoryRequest.build(session, dependency));
}
@Nonnull
default DependencyCoordinate create( @Nonnull Session session, Dependency dependency )
{
return create( DependencyCoordinateFactoryRequest.build( session,
dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
dependency.getClassifier(), null, dependency.getType() ) );
default DependencyCoordinate create(@Nonnull Session session, Dependency dependency) {
return create(DependencyCoordinateFactoryRequest.build(
session,
dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion(),
dependency.getClassifier(),
null,
dependency.getType()));
}
@Nonnull
default DependencyCoordinate create( @Nonnull Session session, Plugin plugin )
{
default DependencyCoordinate create(@Nonnull Session session, Plugin plugin) {
// TODO: hard coded string
return create( DependencyCoordinateFactoryRequest.build( session,
plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
null, null, "maven-plugin" ) );
return create(DependencyCoordinateFactoryRequest.build(
session, plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, null, "maven-plugin"));
}
@Nonnull
default DependencyCoordinate create( @Nonnull Session session, ReportPlugin reportPlugin )
{
default DependencyCoordinate create(@Nonnull Session session, ReportPlugin reportPlugin) {
// TODO: hard coded string
return create( DependencyCoordinateFactoryRequest.build( session,
reportPlugin.getGroupId(), reportPlugin.getArtifactId(), reportPlugin.getVersion(),
null, null, "maven-plugin" ) );
return create(DependencyCoordinateFactoryRequest.build(
session,
reportPlugin.getGroupId(),
reportPlugin.getArtifactId(),
reportPlugin.getVersion(),
null,
null,
"maven-plugin"));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,11 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Dependency;
import org.apache.maven.api.Exclusion;
@ -32,16 +32,13 @@
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
*
* @since 4.0
*/
@Experimental
@Immutable
public interface DependencyCoordinateFactoryRequest extends ArtifactCoordinateFactoryRequest
{
public interface DependencyCoordinateFactoryRequest extends ArtifactCoordinateFactoryRequest {
String getScope();
@ -51,58 +48,59 @@ public interface DependencyCoordinateFactoryRequest extends ArtifactCoordinateFa
Collection<Exclusion> getExclusions();
@Nonnull
static DependencyCoordinateFactoryRequest build( @Nonnull Session session, String groupId, String artifactId,
String version, String classifier, String extension, String type )
{
static DependencyCoordinateFactoryRequest build(
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type) {
return DependencyCoordinateFactoryRequest.builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( groupId )
.artifactId( artifactId )
.version( version )
.classifier( classifier )
.extension( extension )
.type( type )
.session(nonNull(session, "session cannot be null"))
.groupId(groupId)
.artifactId(artifactId)
.version(version)
.classifier(classifier)
.extension(extension)
.type(type)
.build();
}
@Nonnull
static DependencyCoordinateFactoryRequest build( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
{
static DependencyCoordinateFactoryRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinate coordinate) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( nonNull( coordinate, "coordinate cannot be null" ).getGroupId() )
.artifactId( coordinate.getArtifactId() )
.version( coordinate.getVersion().asString() )
.classifier( coordinate.getClassifier() )
.extension( coordinate.getExtension() )
.session(nonNull(session, "session cannot be null"))
.groupId(nonNull(coordinate, "coordinate cannot be null").getGroupId())
.artifactId(coordinate.getArtifactId())
.version(coordinate.getVersion().asString())
.classifier(coordinate.getClassifier())
.extension(coordinate.getExtension())
.build();
}
@Nonnull
static DependencyCoordinateFactoryRequest build( @Nonnull Session session, @Nonnull Dependency dependency )
{
static DependencyCoordinateFactoryRequest build(@Nonnull Session session, @Nonnull Dependency dependency) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.groupId( nonNull( dependency, "dependency" ).getGroupId() )
.artifactId( dependency.getArtifactId() )
.version( dependency.getVersion().asString() )
.classifier( dependency.getClassifier() )
.extension( dependency.getExtension() )
.type( dependency.getType().getName() )
.scope( dependency.getScope().id() )
.optional( dependency.isOptional() )
.session(nonNull(session, "session cannot be null"))
.groupId(nonNull(dependency, "dependency").getGroupId())
.artifactId(dependency.getArtifactId())
.version(dependency.getVersion().asString())
.classifier(dependency.getClassifier())
.extension(dependency.getExtension())
.type(dependency.getType().getName())
.scope(dependency.getScope().id())
.optional(dependency.isOptional())
.build();
}
@Nonnull
static DependencyCoordinateFactoryRequestBuilder builder()
{
static DependencyCoordinateFactoryRequestBuilder builder() {
return new DependencyCoordinateFactoryRequestBuilder();
}
@NotThreadSafe
class DependencyCoordinateFactoryRequestBuilder
{
class DependencyCoordinateFactoryRequestBuilder {
private Session session;
private String groupId;
private String artifactId;
@ -114,100 +112,80 @@ class DependencyCoordinateFactoryRequestBuilder
private boolean optional;
private Collection<Exclusion> exclusions = Collections.emptyList();
DependencyCoordinateFactoryRequestBuilder()
{
}
DependencyCoordinateFactoryRequestBuilder() {}
public DependencyCoordinateFactoryRequestBuilder session( Session session )
{
public DependencyCoordinateFactoryRequestBuilder session(Session session) {
this.session = session;
return this;
}
public DependencyCoordinateFactoryRequestBuilder groupId( String groupId )
{
public DependencyCoordinateFactoryRequestBuilder groupId(String groupId) {
this.groupId = groupId;
return this;
}
public DependencyCoordinateFactoryRequestBuilder artifactId( String artifactId )
{
public DependencyCoordinateFactoryRequestBuilder artifactId(String artifactId) {
this.artifactId = artifactId;
return this;
}
public DependencyCoordinateFactoryRequestBuilder version( String version )
{
public DependencyCoordinateFactoryRequestBuilder version(String version) {
this.version = version;
return this;
}
public DependencyCoordinateFactoryRequestBuilder classifier( String classifier )
{
public DependencyCoordinateFactoryRequestBuilder classifier(String classifier) {
this.classifier = classifier;
return this;
}
public DependencyCoordinateFactoryRequestBuilder extension( String extension )
{
public DependencyCoordinateFactoryRequestBuilder extension(String extension) {
this.extension = extension;
return this;
}
public DependencyCoordinateFactoryRequestBuilder type( String type )
{
public DependencyCoordinateFactoryRequestBuilder type(String type) {
this.type = type;
return this;
}
public DependencyCoordinateFactoryRequestBuilder scope( String scope )
{
public DependencyCoordinateFactoryRequestBuilder scope(String scope) {
this.scope = scope;
return this;
}
public DependencyCoordinateFactoryRequestBuilder optional( boolean optional )
{
public DependencyCoordinateFactoryRequestBuilder optional(boolean optional) {
this.optional = optional;
return this;
}
public DependencyCoordinateFactoryRequestBuilder exclusions( Collection<Exclusion> exclusions )
{
if ( exclusions != null )
{
if ( this.exclusions.isEmpty() )
{
public DependencyCoordinateFactoryRequestBuilder exclusions(Collection<Exclusion> exclusions) {
if (exclusions != null) {
if (this.exclusions.isEmpty()) {
this.exclusions = new ArrayList<>();
}
this.exclusions.addAll( exclusions );
this.exclusions.addAll(exclusions);
}
return this;
}
public DependencyCoordinateFactoryRequestBuilder exclusion( Exclusion exclusion )
{
if ( exclusion != null )
{
if ( this.exclusions.isEmpty() )
{
public DependencyCoordinateFactoryRequestBuilder exclusion(Exclusion exclusion) {
if (exclusion != null) {
if (this.exclusions.isEmpty()) {
this.exclusions = new ArrayList<>();
}
this.exclusions.add( exclusion );
this.exclusions.add(exclusion);
}
return this;
}
public DependencyCoordinateFactoryRequest build()
{
return new DefaultDependencyCoordinateFactoryRequest( session, groupId, artifactId, version,
classifier, extension, type, scope, optional, exclusions );
public DependencyCoordinateFactoryRequest build() {
return new DefaultDependencyCoordinateFactoryRequest(
session, groupId, artifactId, version, classifier, extension, type, scope, optional, exclusions);
}
private static class DefaultDependencyCoordinateFactoryRequest
extends BaseRequest
implements DependencyCoordinateFactoryRequest
{
private static class DefaultDependencyCoordinateFactoryRequest extends BaseRequest
implements DependencyCoordinateFactoryRequest {
private final String groupId;
private final String artifactId;
private final String version;
@ -218,19 +196,19 @@ private static class DefaultDependencyCoordinateFactoryRequest
private final boolean optional;
private final Collection<Exclusion> exclusions;
@SuppressWarnings( "checkstyle:ParameterNumber" )
@SuppressWarnings("checkstyle:ParameterNumber")
private DefaultDependencyCoordinateFactoryRequest(
@Nonnull Session session, String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type,
String scope,
boolean optional,
Collection<Exclusion> exclusions )
{
super( session );
@Nonnull Session session,
String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type,
String scope,
boolean optional,
Collection<Exclusion> exclusions) {
super(session);
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@ -243,60 +221,50 @@ private DefaultDependencyCoordinateFactoryRequest(
}
@Override
public String getGroupId()
{
public String getGroupId() {
return groupId;
}
@Override
public String getArtifactId()
{
public String getArtifactId() {
return artifactId;
}
@Override
public String getVersion()
{
public String getVersion() {
return version;
}
@Override
public String getClassifier()
{
public String getClassifier() {
return classifier;
}
@Override
public String getExtension()
{
public String getExtension() {
return extension;
}
@Override
public String getType()
{
public String getType() {
return type;
}
@Override
public String getScope()
{
public String getScope() {
return scope;
}
@Override
public boolean isOptional()
{
public boolean isOptional() {
return optional;
}
@Nonnull
@Override
public Collection<Exclusion> getExclusions()
{
public Collection<Exclusion> getExclusions() {
return exclusions;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.nio.file.Path;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.LocalRepository;
import org.apache.maven.api.RemoteRepository;
@ -33,11 +31,9 @@
* @since 4.0
*/
@Experimental
public interface LocalRepositoryManager extends Service
{
public interface LocalRepositoryManager extends Service {
Path getPathForLocalArtifact( Session session, LocalRepository local, Artifact artifact );
Path getPathForRemoteArtifact( Session session, LocalRepository local, RemoteRepository remote, Artifact artifact );
Path getPathForLocalArtifact(Session session, LocalRepository local, Artifact artifact);
Path getPathForRemoteArtifact(Session session, LocalRepository local, RemoteRepository remote, Artifact artifact);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,21 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import java.util.Map;
import org.apache.maven.api.Service;
public interface Lookup extends Service
{
public interface Lookup extends Service {
<T> T lookup( Class<T> type );
<T> T lookup(Class<T> type);
<T> T lookup( Class<T> type, String name );
<T> T lookup(Class<T> type, String name);
<T> List<T> lookupList( Class<T> type );
<T> Map<String, T> lookupMap( Class<T> type );
<T> List<T> lookupList(Class<T> type);
<T> Map<String, T> lookupMap(Class<T> type);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,24 +26,19 @@
* @since 4.0
*/
@Experimental
public class LookupException
extends MavenException
{
public class LookupException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public LookupException( String message, Exception e )
{
super( message, e );
public LookupException(String message, Exception e) {
super(message, e);
}
/**
* @param e the {@link Exception}
*/
public LookupException( Exception e )
{
super( e );
public LookupException(Exception e) {
super(e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,25 +26,18 @@
* @since 4.0
*/
@Experimental
public class MavenException extends RuntimeException
{
public MavenException()
{
public class MavenException extends RuntimeException {
public MavenException() {}
public MavenException(String message) {
super(message);
}
public MavenException( String message )
{
super( message );
public MavenException(String message, Throwable cause) {
super(message, cause);
}
public MavenException( String message, Throwable cause )
{
super( message, cause );
public MavenException(Throwable cause) {
super(cause);
}
public MavenException( Throwable cause )
{
super( cause );
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Nonnull;
@ -27,8 +26,7 @@
* @since 4.0
* @see MessageBuilderFactory
*/
public interface MessageBuilder
{
public interface MessageBuilder {
/**
* Append message content in success style.
* By default, bold green
@ -36,7 +34,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder success( Object message );
MessageBuilder success(Object message);
/**
* Append message content in warning style.
@ -45,7 +43,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder warning( Object message );
MessageBuilder warning(Object message);
/**
* Append message content in failure style.
@ -54,7 +52,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder failure( Object message );
MessageBuilder failure(Object message);
/**
* Append message content in strong style.
@ -63,7 +61,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder strong( Object message );
MessageBuilder strong(Object message);
/**
* Append message content in mojo style.
@ -72,7 +70,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder mojo( Object message );
MessageBuilder mojo(Object message);
/**
* Append message content in project style.
@ -81,7 +79,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder project( Object message );
MessageBuilder project(Object message);
//
// message building methods modelled after Ansi methods
@ -94,7 +92,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder a( char[] value, int offset, int len );
MessageBuilder a(char[] value, int offset, int len);
/**
* Append content to the message buffer.
@ -102,7 +100,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder a( char[] value );
MessageBuilder a(char[] value);
/**
* Append content to the message buffer.
@ -112,7 +110,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder a( CharSequence value, int start, int end );
MessageBuilder a(CharSequence value, int start, int end);
/**
* Append content to the message buffer.
@ -120,7 +118,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder a( CharSequence value );
MessageBuilder a(CharSequence value);
/**
* Append content to the message buffer.
@ -128,7 +126,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder a( Object value );
MessageBuilder a(Object value);
/**
* Append newline to the message buffer.
@ -145,7 +143,7 @@ public interface MessageBuilder
* @return the current builder
*/
@Nonnull
MessageBuilder format( String pattern, Object... args );
MessageBuilder format(String pattern, Object... args);
/**
* Return the built message.
@ -153,5 +151,4 @@ public interface MessageBuilder
*/
@Nonnull
String build();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
@ -29,8 +28,7 @@
* @since 4.0
*/
@Experimental
public interface MessageBuilderFactory extends Service
{
public interface MessageBuilderFactory extends Service {
/**
* Checks if the underlying output does support styling or not.
* @return whether color styling is supported or not
@ -56,7 +54,7 @@ public interface MessageBuilderFactory extends Service
* @return a new message builder
*/
@Nonnull
MessageBuilder builder( @Nonnull StringBuilder stringBuilder );
MessageBuilder builder(@Nonnull StringBuilder stringBuilder);
/**
* Creates a new message builder of the specified size.
@ -64,8 +62,7 @@ public interface MessageBuilderFactory extends Service
* @return a new message builder
*/
@Nonnull
default MessageBuilder builder( int size )
{
return builder( new StringBuilder( size ) );
default MessageBuilder builder(int size) {
return builder(new StringBuilder(size));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,23 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api.services;
import java.nio.file.Path;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* @since 4.0
*/
@Experimental
public interface ProjectBuilder extends Service
{
public interface ProjectBuilder extends Service {
/**
* Creates a {@link org.apache.maven.api.Project} from a POM file.
@ -45,7 +41,7 @@ public interface ProjectBuilder extends Service
* @throws IllegalArgumentException if an argument is {@code null} or invalid
*/
@Nonnull
ProjectBuilderResult build( ProjectBuilderRequest request );
ProjectBuilderResult build(ProjectBuilderRequest request);
/**
* Creates a {@link org.apache.maven.api.Project} from a POM file.
@ -57,9 +53,8 @@ public interface ProjectBuilder extends Service
* @see #build(ProjectBuilderRequest)
*/
@Nonnull
default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Source source )
{
return build( ProjectBuilderRequest.build( session, source ) );
default ProjectBuilderResult build(@Nonnull Session session, @Nonnull Source source) {
return build(ProjectBuilderRequest.build(session, source));
}
/**
@ -72,9 +67,8 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Source so
* @see #build(ProjectBuilderRequest)
*/
@Nonnull
default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Path path )
{
return build( ProjectBuilderRequest.build( session, path ) );
default ProjectBuilderResult build(@Nonnull Session session, @Nonnull Path path) {
return build(ProjectBuilderRequest.build(session, path));
}
/**
@ -87,9 +81,8 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Path path
* @see #build(ProjectBuilderRequest)
*/
@Nonnull
default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Artifact artifact )
{
return build( ProjectBuilderRequest.build( session, artifact ) );
default ProjectBuilderResult build(@Nonnull Session session, @Nonnull Artifact artifact) {
return build(ProjectBuilderRequest.build(session, artifact));
}
/**
@ -102,9 +95,7 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Artifact
* @see #build(ProjectBuilderRequest)
*/
@Nonnull
default ProjectBuilderResult build( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
{
return build( ProjectBuilderRequest.build( session, coordinate ) );
default ProjectBuilderResult build(@Nonnull Session session, @Nonnull ArtifactCoordinate coordinate) {
return build(ProjectBuilderRequest.build(session, coordinate));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,12 @@
* @since 4.0
*/
@Experimental
public class ProjectBuilderException
extends MavenException
{
public class ProjectBuilderException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public ProjectBuilderException( String message, Exception e )
{
super( message, e );
public ProjectBuilderException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,22 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.nio.file.Path;
import java.util.Optional;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import org.apache.maven.api.annotations.Nullable;
import java.nio.file.Path;
import java.util.Optional;
import org.apache.maven.api.Session;
import org.apache.maven.api.Artifact;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* Request used to build a {@link org.apache.maven.api.Project} using
* the {@link ProjectBuilder} service.
@ -42,8 +39,7 @@
*/
@Experimental
@Immutable
public interface ProjectBuilderRequest
{
public interface ProjectBuilderRequest {
@Nonnull
Session getSession();
@ -69,50 +65,44 @@ public interface ProjectBuilderRequest
boolean isResolveDependencies();
@Nonnull
static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull Source source )
{
static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull Source source) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.source( nonNull( source, "source cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.source(nonNull(source, "source cannot be null"))
.build();
}
@Nonnull
static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull Path path )
{
static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull Path path) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.path( nonNull( path, "path cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.path(nonNull(path, "path cannot be null"))
.build();
}
@Nonnull
static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull Artifact artifact )
{
static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull Artifact artifact) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.artifact( nonNull( artifact, "artifact cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.artifact(nonNull(artifact, "artifact cannot be null"))
.build();
}
@Nonnull
static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
{
static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinate coordinate) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.coordinate( nonNull( coordinate, "coordinate cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.coordinate(nonNull(coordinate, "coordinate cannot be null"))
.build();
}
@Nonnull
static ProjectBuilderRequestBuilder builder()
{
static ProjectBuilderRequestBuilder builder() {
return new ProjectBuilderRequestBuilder();
}
@NotThreadSafe
class ProjectBuilderRequestBuilder
{
class ProjectBuilderRequestBuilder {
Session session;
Path path;
Source source;
@ -123,61 +113,57 @@ class ProjectBuilderRequestBuilder
boolean processPlugins = true;
boolean resolveDependencies = true;
ProjectBuilderRequestBuilder()
{
}
ProjectBuilderRequestBuilder() {}
public ProjectBuilderRequestBuilder session( Session session )
{
public ProjectBuilderRequestBuilder session(Session session) {
this.session = session;
return this;
}
public ProjectBuilderRequestBuilder path( Path path )
{
public ProjectBuilderRequestBuilder path(Path path) {
this.path = path;
return this;
}
public ProjectBuilderRequestBuilder source( Source source )
{
public ProjectBuilderRequestBuilder source(Source source) {
this.source = source;
return this;
}
public ProjectBuilderRequestBuilder artifact( Artifact artifact )
{
public ProjectBuilderRequestBuilder artifact(Artifact artifact) {
this.artifact = artifact;
return this;
}
public ProjectBuilderRequestBuilder coordinate( ArtifactCoordinate coordinate )
{
public ProjectBuilderRequestBuilder coordinate(ArtifactCoordinate coordinate) {
this.coordinate = coordinate;
return this;
}
public ProjectBuilderRequestBuilder processPlugins( boolean processPlugins )
{
public ProjectBuilderRequestBuilder processPlugins(boolean processPlugins) {
this.processPlugins = processPlugins;
return this;
}
public ProjectBuilderRequestBuilder resolveDependencies( boolean resolveDependencies )
{
public ProjectBuilderRequestBuilder resolveDependencies(boolean resolveDependencies) {
this.resolveDependencies = resolveDependencies;
return this;
}
public ProjectBuilderRequest build()
{
return new DefaultProjectBuilderRequest( session, path, source, artifact, coordinate,
allowStubModel, recursive, processPlugins, resolveDependencies );
public ProjectBuilderRequest build() {
return new DefaultProjectBuilderRequest(
session,
path,
source,
artifact,
coordinate,
allowStubModel,
recursive,
processPlugins,
resolveDependencies);
}
private static class DefaultProjectBuilderRequest extends BaseRequest
implements ProjectBuilderRequest
{
private static class DefaultProjectBuilderRequest extends BaseRequest implements ProjectBuilderRequest {
private final Path path;
private final Source source;
private final Artifact artifact;
@ -187,18 +173,18 @@ private static class DefaultProjectBuilderRequest extends BaseRequest
private final boolean processPlugins;
private final boolean resolveDependencies;
@SuppressWarnings( "checkstyle:ParameterNumber" )
DefaultProjectBuilderRequest( @Nonnull Session session,
@Nullable Path path,
@Nullable Source source,
@Nullable Artifact artifact,
@Nullable ArtifactCoordinate coordinate,
boolean allowStubModel,
boolean recursive,
boolean processPlugins,
boolean resolveDependencies )
{
super( session );
@SuppressWarnings("checkstyle:ParameterNumber")
DefaultProjectBuilderRequest(
@Nonnull Session session,
@Nullable Path path,
@Nullable Source source,
@Nullable Artifact artifact,
@Nullable ArtifactCoordinate coordinate,
boolean allowStubModel,
boolean recursive,
boolean processPlugins,
boolean resolveDependencies) {
super(session);
this.path = path;
this.source = source;
this.artifact = artifact;
@ -211,56 +197,47 @@ private static class DefaultProjectBuilderRequest extends BaseRequest
@Nonnull
@Override
public Optional<Path> getPath()
{
return Optional.ofNullable( path );
public Optional<Path> getPath() {
return Optional.ofNullable(path);
}
@Nonnull
@Override
public Optional<Source> getSource()
{
return Optional.ofNullable( source );
public Optional<Source> getSource() {
return Optional.ofNullable(source);
}
@Nonnull
@Override
public Optional<Artifact> getArtifact()
{
return Optional.ofNullable( artifact );
public Optional<Artifact> getArtifact() {
return Optional.ofNullable(artifact);
}
@Nonnull
@Override
public Optional<ArtifactCoordinate> getCoordinate()
{
return Optional.ofNullable( coordinate );
public Optional<ArtifactCoordinate> getCoordinate() {
return Optional.ofNullable(coordinate);
}
@Override
public boolean isAllowStubModel()
{
public boolean isAllowStubModel() {
return allowStubModel;
}
@Override
public boolean isRecursive()
{
public boolean isRecursive() {
return recursive;
}
@Override
public boolean isProcessPlugins()
{
public boolean isProcessPlugins() {
return processPlugins;
}
@Override
public boolean isResolveDependencies()
{
public boolean isResolveDependencies() {
return resolveDependencies;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,15 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api.services;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Optional;
import org.apache.maven.api.Project;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* Result of a project build call.
@ -34,8 +31,7 @@
* @since 4.0
*/
@Experimental
public interface ProjectBuilderResult
{
public interface ProjectBuilderResult {
/**
* Gets the identifier of the project that could not be built. The general format of the identifier is {@code
@ -79,5 +75,4 @@ public interface ProjectBuilderResult
*/
@Nonnull
Optional<DependencyCollectorResult> getDependencyResolverResult();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,22 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
package org.apache.maven.api.services;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.Node;
import org.apache.maven.api.Project;
import org.apache.maven.api.RemoteRepository;
import org.apache.maven.api.ResolutionScope;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
/**
* Interface to manage the project during its lifecycle.
@ -41,8 +38,7 @@
* @since 4.0
*/
@Experimental
public interface ProjectManager extends Service
{
public interface ProjectManager extends Service {
/**
* Returns the path to the resolved file in the local repository
* if the artifact has been resolved.
@ -50,44 +46,41 @@ public interface ProjectManager extends Service
* @return the path of the resolved artifact
*/
@Nonnull
Optional<Path> getPath( Project project );
Optional<Path> getPath(Project project);
@Nonnull
Collection<Artifact> getAttachedArtifacts( Project project );
Collection<Artifact> getAttachedArtifacts(Project project);
default void attachArtifact( Session session, Project project, Path path )
{
default void attachArtifact(Session session, Project project, Path path) {
String name = path.getFileName().toString();
int dot = name.lastIndexOf( '.' );
String ext = dot >= 1 ? name.substring( dot + 1 ) : "";
Artifact artifact = session.createArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion(), ext );
attachArtifact( project, artifact, path );
int dot = name.lastIndexOf('.');
String ext = dot >= 1 ? name.substring(dot + 1) : "";
Artifact artifact =
session.createArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion(), ext);
attachArtifact(project, artifact, path);
}
default void attachArtifact( Session session, Project project, String type, Path path )
{
Artifact artifact = session.createArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion(), null, null, type );
attachArtifact( project, artifact, path );
default void attachArtifact(Session session, Project project, String type, Path path) {
Artifact artifact = session.createArtifact(
project.getGroupId(), project.getArtifactId(), project.getVersion(), null, null, type);
attachArtifact(project, artifact, path);
}
void attachArtifact( Project project, Artifact artifact, Path path );
void attachArtifact(Project project, Artifact artifact, Path path);
List<String> getCompileSourceRoots( Project project );
List<String> getCompileSourceRoots(Project project);
void addCompileSourceRoot( Project project, String sourceRoot );
void addCompileSourceRoot(Project project, String sourceRoot);
List<String> getTestCompileSourceRoots( Project project );
List<String> getTestCompileSourceRoots(Project project);
void addTestCompileSourceRoot( Project project, String sourceRoot );
void addTestCompileSourceRoot(Project project, String sourceRoot);
List<RemoteRepository> getRepositories( Project project );
List<RemoteRepository> getRepositories(Project project);
List<Artifact> getResolvedDependencies( Project project, ResolutionScope scope );
List<Artifact> getResolvedDependencies(Project project, ResolutionScope scope);
Node getCollectedDependencies( Project project, ResolutionScope scope );
void setProperty( Project project, String key, String value );
Node getCollectedDependencies(Project project, ResolutionScope scope);
void setProperty(Project project, String key, String value);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
@ -30,8 +28,7 @@
* @since 4.0
*/
@Experimental
public interface Prompter extends Service
{
public interface Prompter extends Service {
/**
* Prompts the user for a string.
*
@ -39,10 +36,8 @@ public interface Prompter extends Service
* @return the string entered by the user
* @throws PrompterException if an exception occurs
*/
default String prompt( String message )
throws PrompterException
{
return prompt( message, null, null );
default String prompt(String message) throws PrompterException {
return prompt(message, null, null);
}
/**
@ -53,10 +48,8 @@ default String prompt( String message )
* @return the string entered by the user
* @throws PrompterException if an exception occurs
*/
default String prompt( String message, String defaultReply )
throws PrompterException
{
return prompt( message, null, defaultReply );
default String prompt(String message, String defaultReply) throws PrompterException {
return prompt(message, null, defaultReply);
}
/**
@ -67,10 +60,8 @@ default String prompt( String message, String defaultReply )
* @return the string entered by the user
* @throws PrompterException if an exception occurs
*/
default String prompt( String message, List<String> possibleValues )
throws PrompterException
{
return prompt( message, possibleValues, null );
default String prompt(String message, List<String> possibleValues) throws PrompterException {
return prompt(message, possibleValues, null);
}
/**
@ -82,8 +73,7 @@ default String prompt( String message, List<String> possibleValues )
* @return the string entered by the user
* @throws PrompterException if an exception occurs
*/
String prompt( String message, List<String> possibleValues, String defaultReply )
throws PrompterException;
String prompt(String message, List<String> possibleValues, String defaultReply) throws PrompterException;
/**
* Prompts the user for a password.
@ -92,8 +82,7 @@ String prompt( String message, List<String> possibleValues, String defaultReply
* @return the password entered by the user
* @throws PrompterException if an exception occurs
*/
String promptForPassword( String message )
throws PrompterException;
String promptForPassword(String message) throws PrompterException;
/**
* Displays a message to the user.
@ -101,6 +90,5 @@ String promptForPassword( String message )
* @param message the message to display
* @throws PrompterException if an exception occurs
*/
void showMessage( String message )
throws PrompterException;
void showMessage(String message) throws PrompterException;
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,12 @@
* @since 4.0
*/
@Experimental
public class PrompterException
extends MavenException
{
public class PrompterException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public PrompterException( String message, Exception e )
{
super( message, e );
public PrompterException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.nio.file.Path;
import org.apache.maven.api.LocalRepository;
import org.apache.maven.api.RemoteRepository;
import org.apache.maven.api.Service;
@ -34,16 +32,14 @@
* @since 4.0
*/
@Experimental
public interface RepositoryFactory extends Service
{
public interface RepositoryFactory extends Service {
@Nonnull
LocalRepository createLocal( @Nonnull Path path );
LocalRepository createLocal(@Nonnull Path path);
@Nonnull
RemoteRepository createRemote( @Nonnull String id, @Nonnull String url );
RemoteRepository createRemote(@Nonnull String id, @Nonnull String url);
@Nonnull
RemoteRepository createRemote( @Nonnull Repository repository );
RemoteRepository createRemote(@Nonnull Repository repository);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.nio.file.Path;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Nonnull;
@ -28,8 +26,7 @@
/**
* Builds the effective settings from a user settings file and/or a global settings file.
*/
public interface SettingsBuilder extends Service
{
public interface SettingsBuilder extends Service {
/**
* Builds the effective settings of the specified settings files.
@ -39,7 +36,7 @@ public interface SettingsBuilder extends Service
* @throws SettingsBuilderException if the effective settings could not be built
*/
@Nonnull
SettingsBuilderResult build( @Nonnull SettingsBuilderRequest request );
SettingsBuilderResult build(@Nonnull SettingsBuilderRequest request);
/**
* Builds the effective settings of the specified settings sources.
@ -48,11 +45,9 @@ public interface SettingsBuilder extends Service
* @throws SettingsBuilderException if the effective settings could not be built
*/
@Nonnull
default SettingsBuilderResult build( @Nonnull Session session,
@Nonnull Source globalSettingsSource,
@Nonnull Source userSettingsSource )
{
return build( SettingsBuilderRequest.build( session, globalSettingsSource, userSettingsSource ) );
default SettingsBuilderResult build(
@Nonnull Session session, @Nonnull Source globalSettingsSource, @Nonnull Source userSettingsSource) {
return build(SettingsBuilderRequest.build(session, globalSettingsSource, userSettingsSource));
}
/**
@ -62,10 +57,8 @@ default SettingsBuilderResult build( @Nonnull Session session,
* @throws SettingsBuilderException if the effective settings could not be built
*/
@Nonnull
default SettingsBuilderResult build( @Nonnull Session session,
@Nonnull Path globalSettingsPath,
@Nonnull Path userSettingsPath )
{
return build( SettingsBuilderRequest.build( session, globalSettingsPath, userSettingsPath ) );
default SettingsBuilderResult build(
@Nonnull Session session, @Nonnull Path globalSettingsPath, @Nonnull Path userSettingsPath) {
return build(SettingsBuilderRequest.build(session, globalSettingsPath, userSettingsPath));
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,13 @@
* @since 4.0
*/
@Experimental
public class SettingsBuilderException
extends MavenException
{
public class SettingsBuilderException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public SettingsBuilderException( String message, Exception e )
{
super( message, e );
public SettingsBuilderException(String message, Exception e) {
super(message, e);
}
// TODO: add SettingsBuilderResult

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.nio.file.Path;
import java.util.Optional;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
@ -29,15 +29,12 @@
import org.apache.maven.api.annotations.NotThreadSafe;
import org.apache.maven.api.annotations.Nullable;
import static org.apache.maven.api.services.BaseRequest.nonNull;
/**
* Collects settings that control the building of effective settings.
*/
@Experimental
@Immutable
public interface SettingsBuilderRequest
{
public interface SettingsBuilderRequest {
@Nonnull
Session getSession();
@ -75,97 +72,82 @@ public interface SettingsBuilderRequest
Optional<Source> getUserSettingsSource();
@Nonnull
static SettingsBuilderRequest build( @Nonnull Session session,
@Nonnull Source globalSettingsSource,
@Nonnull Source userSettingsSource )
{
static SettingsBuilderRequest build(
@Nonnull Session session, @Nonnull Source globalSettingsSource, @Nonnull Source userSettingsSource) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.globalSettingsSource( nonNull( globalSettingsSource, "globalSettingsSource cannot be null" ) )
.userSettingsSource( nonNull( userSettingsSource, "userSettingsSource cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.globalSettingsSource(nonNull(globalSettingsSource, "globalSettingsSource cannot be null"))
.userSettingsSource(nonNull(userSettingsSource, "userSettingsSource cannot be null"))
.build();
}
@Nonnull
static SettingsBuilderRequest build( @Nonnull Session session,
@Nonnull Path globalSettingsPath,
@Nonnull Path userSettingsPath )
{
static SettingsBuilderRequest build(
@Nonnull Session session, @Nonnull Path globalSettingsPath, @Nonnull Path userSettingsPath) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.globalSettingsPath( nonNull( globalSettingsPath, "globalSettingsPath cannot be null" ) )
.userSettingsPath( nonNull( userSettingsPath, "userSettingsPath cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.globalSettingsPath(nonNull(globalSettingsPath, "globalSettingsPath cannot be null"))
.userSettingsPath(nonNull(userSettingsPath, "userSettingsPath cannot be null"))
.build();
}
@Nonnull
static SettingsBuilderRequestBuilder builder()
{
static SettingsBuilderRequestBuilder builder() {
return new SettingsBuilderRequestBuilder();
}
@NotThreadSafe
class SettingsBuilderRequestBuilder
{
class SettingsBuilderRequestBuilder {
Session session;
Path globalSettingsPath;
Source globalSettingsSource;
Path userSettingsPath;
Source userSettingsSource;
public SettingsBuilderRequestBuilder session( Session session )
{
public SettingsBuilderRequestBuilder session(Session session) {
this.session = session;
return this;
}
public SettingsBuilderRequestBuilder globalSettingsPath( Path globalSettingsPath )
{
public SettingsBuilderRequestBuilder globalSettingsPath(Path globalSettingsPath) {
this.globalSettingsPath = globalSettingsPath;
return this;
}
public SettingsBuilderRequestBuilder globalSettingsSource( Source globalSettingsSource )
{
public SettingsBuilderRequestBuilder globalSettingsSource(Source globalSettingsSource) {
this.globalSettingsSource = globalSettingsSource;
return this;
}
public SettingsBuilderRequestBuilder userSettingsPath( Path userSettingsPath )
{
public SettingsBuilderRequestBuilder userSettingsPath(Path userSettingsPath) {
this.userSettingsPath = userSettingsPath;
return this;
}
public SettingsBuilderRequestBuilder userSettingsSource( Source userSettingsSource )
{
public SettingsBuilderRequestBuilder userSettingsSource(Source userSettingsSource) {
this.userSettingsSource = userSettingsSource;
return this;
}
public SettingsBuilderRequest build()
{
return new DefaultSettingsBuilderRequest( session,
globalSettingsPath, globalSettingsSource,
userSettingsPath, userSettingsSource );
public SettingsBuilderRequest build() {
return new DefaultSettingsBuilderRequest(
session, globalSettingsPath, globalSettingsSource, userSettingsPath, userSettingsSource);
}
private static class DefaultSettingsBuilderRequest extends BaseRequest
implements SettingsBuilderRequest
{
private static class DefaultSettingsBuilderRequest extends BaseRequest implements SettingsBuilderRequest {
private final Path globalSettingsPath;
private final Source globalSettingsSource;
private final Path userSettingsPath;
private final Source userSettingsSource;
@SuppressWarnings( "checkstyle:ParameterNumber" )
DefaultSettingsBuilderRequest( @Nonnull Session session,
@Nullable Path globalSettingsPath,
@Nullable Source globalSettingsSource,
@Nullable Path userSettingsPath,
@Nullable Source userSettingsSource )
{
super( session );
@SuppressWarnings("checkstyle:ParameterNumber")
DefaultSettingsBuilderRequest(
@Nonnull Session session,
@Nullable Path globalSettingsPath,
@Nullable Source globalSettingsSource,
@Nullable Path userSettingsPath,
@Nullable Source userSettingsSource) {
super(session);
this.globalSettingsPath = globalSettingsPath;
this.globalSettingsSource = globalSettingsSource;
this.userSettingsPath = userSettingsPath;
@ -174,30 +156,26 @@ private static class DefaultSettingsBuilderRequest extends BaseRequest
@Nonnull
@Override
public Optional<Path> getGlobalSettingsPath()
{
return Optional.ofNullable( globalSettingsPath );
public Optional<Path> getGlobalSettingsPath() {
return Optional.ofNullable(globalSettingsPath);
}
@Nonnull
@Override
public Optional<Source> getGlobalSettingsSource()
{
return Optional.ofNullable( globalSettingsSource );
public Optional<Source> getGlobalSettingsSource() {
return Optional.ofNullable(globalSettingsSource);
}
@Nonnull
@Override
public Optional<Path> getUserSettingsPath()
{
return Optional.ofNullable( userSettingsPath );
public Optional<Path> getUserSettingsPath() {
return Optional.ofNullable(userSettingsPath);
}
@Nonnull
@Override
public Optional<Source> getUserSettingsSource()
{
return Optional.ofNullable( userSettingsSource );
public Optional<Source> getUserSettingsSource() {
return Optional.ofNullable(userSettingsSource);
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.settings.Settings;
public interface SettingsBuilderResult
{
public interface SettingsBuilderResult {
/**
* Gets the assembled settings.
@ -44,5 +41,4 @@ public interface SettingsBuilderResult
*/
@Nonnull
List<BuilderProblem> getProblems();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -18,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.io.IOException;
import java.io.InputStream;
import org.apache.maven.api.annotations.Experimental;
/**
@ -30,8 +28,7 @@
* @since 4.0
*/
@Experimental
public interface Source
{
public interface Source {
InputStream getInputStream() throws IOException;
String getLocation();

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;
@ -27,7 +26,6 @@
*/
@Experimental
@Consumer
public interface ToolchainFactory
{
public interface ToolchainFactory {
// TODO: implement ToolchainFactory
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.Toolchain;
@ -35,8 +33,7 @@
* @since 4.0
*/
@Experimental
public interface ToolchainManager extends Service
{
public interface ToolchainManager extends Service {
/**
*
@ -47,7 +44,7 @@ public interface ToolchainManager extends Service
* @throws ToolchainManagerException if an exception occurs
*/
@Nonnull
List<Toolchain> getToolchains( @Nonnull Session session, String type, Map<String, String> requirements );
List<Toolchain> getToolchains(@Nonnull Session session, String type, Map<String, String> requirements);
/**
*
@ -57,7 +54,7 @@ public interface ToolchainManager extends Service
* @throws ToolchainManagerException if an exception occurs
*/
@Nonnull
Optional<Toolchain> getToolchainFromBuildContext( @Nonnull Session session, String type )
Optional<Toolchain> getToolchainFromBuildContext(@Nonnull Session session, String type)
throws ToolchainManagerException;
/**
@ -68,8 +65,7 @@ Optional<Toolchain> getToolchainFromBuildContext( @Nonnull Session session, Stri
* @throws ToolchainManagerException if an exception occurs
*/
@Nonnull
List<Toolchain> getToolchainsForType( @Nonnull Session session, String type )
throws ToolchainManagerException;
List<Toolchain> getToolchainsForType(@Nonnull Session session, String type) throws ToolchainManagerException;
/**
*
@ -77,6 +73,5 @@ List<Toolchain> getToolchainsForType( @Nonnull Session session, String type )
* @param toolchain
* @throws ToolchainManagerException if an exception occurs
*/
void storeToolchainToBuildContext( @Nonnull Session session, Toolchain toolchain )
throws ToolchainManagerException;
void storeToolchainToBuildContext(@Nonnull Session session, Toolchain toolchain) throws ToolchainManagerException;
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,12 @@
* @since 4.0
*/
@Experimental
public class ToolchainManagerException
extends MavenException
{
public class ToolchainManagerException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public ToolchainManagerException( String message, Exception e )
{
super( message, e );
public ToolchainManagerException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
@ -26,9 +25,7 @@
* Builds the effective toolchains from a user toolchains file and/or a global toolchains file.
*/
@Experimental
public interface ToolchainsBuilder extends Service
{
public interface ToolchainsBuilder extends Service {
/**
* Builds the effective toolchains of the specified toolchains files.
@ -37,6 +34,5 @@ public interface ToolchainsBuilder extends Service
* @return the result of the toolchains building, never {@code null}
* @throws ToolchainsBuilderException if the effective toolchains could not be built
*/
ToolchainsBuilderResult build( ToolchainsBuilderRequest request );
ToolchainsBuilderResult build(ToolchainsBuilderRequest request);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,13 @@
* @since 4.0
*/
@Experimental
public class ToolchainsBuilderException
extends MavenException
{
public class ToolchainsBuilderException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public ToolchainsBuilderException( String message, Exception e )
{
super( message, e );
public ToolchainsBuilderException(String message, Exception e) {
super(message, e);
}
// TODO: add ToolchainsBuilderResult

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import static org.apache.maven.api.services.BaseRequest.nonNull;
import java.nio.file.Path;
import java.util.Optional;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.NotThreadSafe;
import org.apache.maven.api.annotations.Nullable;
import static org.apache.maven.api.services.BaseRequest.nonNull;
public interface ToolchainsBuilderRequest
{
public interface ToolchainsBuilderRequest {
@Nonnull
Session getSession();
@ -67,97 +64,82 @@ public interface ToolchainsBuilderRequest
Optional<Source> getUserToolchainsSource();
@Nonnull
static ToolchainsBuilderRequest build( @Nonnull Session session,
@Nonnull Source globalToolchainsSource,
@Nonnull Source userToolchainsSource )
{
static ToolchainsBuilderRequest build(
@Nonnull Session session, @Nonnull Source globalToolchainsSource, @Nonnull Source userToolchainsSource) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.globalToolchainsSource( nonNull( globalToolchainsSource, "globalToolchainsSource cannot be null" ) )
.userToolchainsSource( nonNull( userToolchainsSource, "userToolchainsSource cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.globalToolchainsSource(nonNull(globalToolchainsSource, "globalToolchainsSource cannot be null"))
.userToolchainsSource(nonNull(userToolchainsSource, "userToolchainsSource cannot be null"))
.build();
}
@Nonnull
static ToolchainsBuilderRequest build( @Nonnull Session session,
@Nonnull Path globalToolchainsPath,
@Nonnull Path userToolchainsPath )
{
static ToolchainsBuilderRequest build(
@Nonnull Session session, @Nonnull Path globalToolchainsPath, @Nonnull Path userToolchainsPath) {
return builder()
.session( nonNull( session, "session cannot be null" ) )
.globalToolchainsPath( nonNull( globalToolchainsPath, "globalToolchainsPath cannot be null" ) )
.userToolchainsPath( nonNull( userToolchainsPath, "userToolchainsPath cannot be null" ) )
.session(nonNull(session, "session cannot be null"))
.globalToolchainsPath(nonNull(globalToolchainsPath, "globalToolchainsPath cannot be null"))
.userToolchainsPath(nonNull(userToolchainsPath, "userToolchainsPath cannot be null"))
.build();
}
@Nonnull
static ToolchainsBuilderRequestBuilder builder()
{
static ToolchainsBuilderRequestBuilder builder() {
return new ToolchainsBuilderRequestBuilder();
}
@NotThreadSafe
class ToolchainsBuilderRequestBuilder
{
class ToolchainsBuilderRequestBuilder {
Session session;
Path globalToolchainsPath;
Source globalToolchainsSource;
Path userToolchainsPath;
Source userToolchainsSource;
public ToolchainsBuilderRequestBuilder session( Session session )
{
public ToolchainsBuilderRequestBuilder session(Session session) {
this.session = session;
return this;
}
public ToolchainsBuilderRequestBuilder globalToolchainsPath( Path globalToolchainsPath )
{
public ToolchainsBuilderRequestBuilder globalToolchainsPath(Path globalToolchainsPath) {
this.globalToolchainsPath = globalToolchainsPath;
return this;
}
public ToolchainsBuilderRequestBuilder globalToolchainsSource( Source globalToolchainsSource )
{
public ToolchainsBuilderRequestBuilder globalToolchainsSource(Source globalToolchainsSource) {
this.globalToolchainsSource = globalToolchainsSource;
return this;
}
public ToolchainsBuilderRequestBuilder userToolchainsPath( Path userToolchainsPath )
{
public ToolchainsBuilderRequestBuilder userToolchainsPath(Path userToolchainsPath) {
this.userToolchainsPath = userToolchainsPath;
return this;
}
public ToolchainsBuilderRequestBuilder userToolchainsSource( Source userToolchainsSource )
{
public ToolchainsBuilderRequestBuilder userToolchainsSource(Source userToolchainsSource) {
this.userToolchainsSource = userToolchainsSource;
return this;
}
public ToolchainsBuilderRequest build()
{
return new ToolchainsBuilderRequestBuilder.DefaultToolchainsBuilderRequest( session,
globalToolchainsPath, globalToolchainsSource,
userToolchainsPath, userToolchainsSource );
public ToolchainsBuilderRequest build() {
return new ToolchainsBuilderRequestBuilder.DefaultToolchainsBuilderRequest(
session, globalToolchainsPath, globalToolchainsSource, userToolchainsPath, userToolchainsSource);
}
private static class DefaultToolchainsBuilderRequest extends BaseRequest
implements ToolchainsBuilderRequest
{
private static class DefaultToolchainsBuilderRequest extends BaseRequest implements ToolchainsBuilderRequest {
private final Path globalToolchainsPath;
private final Source globalToolchainsSource;
private final Path userToolchainsPath;
private final Source userToolchainsSource;
@SuppressWarnings( "checkstyle:ParameterNumber" )
DefaultToolchainsBuilderRequest( @Nonnull Session session,
@Nullable Path globalToolchainsPath,
@Nullable Source globalToolchainsSource,
@Nullable Path userToolchainsPath,
@Nullable Source userToolchainsSource )
{
super( session );
@SuppressWarnings("checkstyle:ParameterNumber")
DefaultToolchainsBuilderRequest(
@Nonnull Session session,
@Nullable Path globalToolchainsPath,
@Nullable Source globalToolchainsSource,
@Nullable Path userToolchainsPath,
@Nullable Source userToolchainsSource) {
super(session);
this.globalToolchainsPath = globalToolchainsPath;
this.globalToolchainsSource = globalToolchainsSource;
this.userToolchainsPath = userToolchainsPath;
@ -166,30 +148,26 @@ private static class DefaultToolchainsBuilderRequest extends BaseRequest
@Nonnull
@Override
public Optional<Path> getGlobalToolchainsPath()
{
return Optional.ofNullable( globalToolchainsPath );
public Optional<Path> getGlobalToolchainsPath() {
return Optional.ofNullable(globalToolchainsPath);
}
@Nonnull
@Override
public Optional<Source> getGlobalToolchainsSource()
{
return Optional.ofNullable( globalToolchainsSource );
public Optional<Source> getGlobalToolchainsSource() {
return Optional.ofNullable(globalToolchainsSource);
}
@Nonnull
@Override
public Optional<Path> getUserToolchainsPath()
{
return Optional.ofNullable( userToolchainsPath );
public Optional<Path> getUserToolchainsPath() {
return Optional.ofNullable(userToolchainsPath);
}
@Nonnull
@Override
public Optional<Source> getUserToolchainsSource()
{
return Optional.ofNullable( userToolchainsSource );
public Optional<Source> getUserToolchainsSource() {
return Optional.ofNullable(userToolchainsSource);
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import java.util.List;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.toolchain.PersistedToolchains;
public interface ToolchainsBuilderResult
{
public interface ToolchainsBuilderResult {
/**
* Gets the assembled toolchains.
*
@ -43,5 +40,4 @@ public interface ToolchainsBuilderResult
*/
@Nonnull
List<BuilderProblem> getProblems();
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Service;
import org.apache.maven.api.Type;
@ -30,8 +29,7 @@
* @since 4.0
*/
@Experimental
public interface TypeRegistry extends Service
{
public interface TypeRegistry extends Service {
/**
* Obtain the {@link Type} from the specified {@code id}.
@ -42,6 +40,5 @@ public interface TypeRegistry extends Service
* @return the type
*/
@Nonnull
Type getType( @Nonnull String id );
Type getType(@Nonnull String id);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.Service;
import org.apache.maven.api.Version;
@ -31,8 +30,7 @@
* @since 4.0
*/
@Experimental
public interface VersionParser extends Service
{
public interface VersionParser extends Service {
/**
* Parses the specified version string, for example "1.0".
*
@ -42,7 +40,7 @@ public interface VersionParser extends Service
* @see org.apache.maven.api.Session#parseVersion(String)
*/
@Nonnull
Version parseVersion( @Nonnull String version );
Version parseVersion(@Nonnull String version);
/**
* Parses the specified version range specification, for example "[1.0,2.0)".
@ -52,11 +50,10 @@ public interface VersionParser extends Service
* @throws VersionParserException if the range specification violates the syntax rules of this scheme
*/
@Nonnull
VersionRange parseVersionRange( @Nonnull String range );
VersionRange parseVersionRange(@Nonnull String range);
/**
* Checks whether a given artifact version is considered a {@code SNAPSHOT} or not.
*/
boolean isSnapshot( @Nonnull String version );
boolean isSnapshot(@Nonnull String version);
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services;
import org.apache.maven.api.annotations.Experimental;
@ -27,16 +26,12 @@
* @since 4.0
*/
@Experimental
public class VersionParserException
extends MavenException
{
public class VersionParserException extends MavenException {
/**
* @param message the message to give
* @param e the {@link Exception}
*/
public VersionParserException( String message, Exception e )
{
super( message, e );
public VersionParserException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.model.Model;
@ -28,7 +27,4 @@
* @since 4.0
*/
@Experimental
public interface ModelXmlFactory extends XmlFactory<Model>
{
}
public interface ModelXmlFactory extends XmlFactory<Model> {}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.settings.Settings;
@ -28,7 +27,4 @@
* @since 4.0
*/
@Experimental
public interface SettingsXmlFactory extends XmlFactory<Settings>
{
}
public interface SettingsXmlFactory extends XmlFactory<Settings> {}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.toolchain.PersistedToolchains;
@ -28,7 +27,4 @@
* @since 4.0
*/
@Experimental
public interface ToolchainsXmlFactory extends XmlFactory<PersistedToolchains>
{
}
public interface ToolchainsXmlFactory extends XmlFactory<PersistedToolchains> {}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import java.io.InputStream;
import java.io.OutputStream;
@ -26,10 +25,9 @@
import java.io.StringWriter;
import java.io.Writer;
import java.nio.file.Path;
import org.apache.maven.api.Service;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.Service;
/**
* Generic interface to read/write objects to/from XML.
@ -38,64 +36,57 @@
* @since 4.0
*/
@Experimental
public interface XmlFactory<T> extends Service
{
public interface XmlFactory<T> extends Service {
@Nonnull
default T read( @Nonnull Path path ) throws XmlReaderException
{
return read( path, true );
default T read(@Nonnull Path path) throws XmlReaderException {
return read(path, true);
}
@Nonnull
default T read( @Nonnull Path path, boolean strict ) throws XmlReaderException
{
return read( XmlReaderRequest.builder().path( path ).strict( strict ).build() );
default T read(@Nonnull Path path, boolean strict) throws XmlReaderException {
return read(XmlReaderRequest.builder().path(path).strict(strict).build());
}
@Nonnull
default T read( @Nonnull InputStream input ) throws XmlReaderException
{
return read( input, true );
default T read(@Nonnull InputStream input) throws XmlReaderException {
return read(input, true);
}
@Nonnull
default T read( @Nonnull InputStream input, boolean strict ) throws XmlReaderException
{
return read( XmlReaderRequest.builder().inputStream( input ).strict( strict ).build() );
default T read(@Nonnull InputStream input, boolean strict) throws XmlReaderException {
return read(XmlReaderRequest.builder().inputStream(input).strict(strict).build());
}
@Nonnull
default T read( @Nonnull Reader reader ) throws XmlReaderException
{
return read( reader, true );
default T read(@Nonnull Reader reader) throws XmlReaderException {
return read(reader, true);
}
@Nonnull
default T read( @Nonnull Reader reader, boolean strict ) throws XmlReaderException
{
return read( XmlReaderRequest.builder().reader( reader ).strict( strict ).build() );
default T read(@Nonnull Reader reader, boolean strict) throws XmlReaderException {
return read(XmlReaderRequest.builder().reader(reader).strict(strict).build());
}
@Nonnull
T read( @Nonnull XmlReaderRequest request ) throws XmlReaderException;
T read(@Nonnull XmlReaderRequest request) throws XmlReaderException;
default void write( @Nonnull T content, @Nonnull Path path ) throws XmlWriterException
{
write( XmlWriterRequest.<T>builder().content( content ).path( path ).build() );
default void write(@Nonnull T content, @Nonnull Path path) throws XmlWriterException {
write(XmlWriterRequest.<T>builder().content(content).path(path).build());
}
default void write( @Nonnull T content, @Nonnull OutputStream outputStream ) throws XmlWriterException
{
write( XmlWriterRequest.<T>builder().content( content ).outputStream( outputStream ).build() );
default void write(@Nonnull T content, @Nonnull OutputStream outputStream) throws XmlWriterException {
write(XmlWriterRequest.<T>builder()
.content(content)
.outputStream(outputStream)
.build());
}
default void write( @Nonnull T content, @Nonnull Writer writer ) throws XmlWriterException
{
write( XmlWriterRequest.<T>builder().content( content ).writer( writer ).build() );
default void write(@Nonnull T content, @Nonnull Writer writer) throws XmlWriterException {
write(XmlWriterRequest.<T>builder().content(content).writer(writer).build());
}
void write( @Nonnull XmlWriterRequest<T> request ) throws XmlWriterException;
void write(@Nonnull XmlWriterRequest<T> request) throws XmlWriterException;
/**
* Simply parse the given xml string.
@ -105,9 +96,8 @@ default void write( @Nonnull T content, @Nonnull Writer writer ) throws XmlWrite
* @throws XmlReaderException if an error occurs during the parsing
* @see #toXmlString(Object)
*/
default T fromXmlString( @Nonnull String xml ) throws XmlReaderException
{
return read( new StringReader( xml ) );
default T fromXmlString(@Nonnull String xml) throws XmlReaderException {
return read(new StringReader(xml));
}
/**
@ -118,11 +108,9 @@ default T fromXmlString( @Nonnull String xml ) throws XmlReaderException
* @throws XmlWriterException if an error occurs during the transformation
* @see #fromXmlString(String)
*/
default String toXmlString( @Nonnull T content ) throws XmlWriterException
{
default String toXmlString(@Nonnull T content) throws XmlWriterException {
StringWriter sw = new StringWriter();
write( content, sw );
write(content, sw);
return sw.toString();
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.services.MavenException;
@ -28,17 +27,13 @@
* @since 4.0
*/
@Experimental
public class XmlReaderException
extends MavenException
{
public class XmlReaderException extends MavenException {
/**
* @param message the message for the exception
* @param e the exception itself
*/
public XmlReaderException( String message, Exception e )
{
super( message, e );
public XmlReaderException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,12 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import java.io.InputStream;
import java.io.Reader;
import java.net.URL;
import java.nio.file.Path;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
@ -36,8 +34,7 @@
*/
@Experimental
@Immutable
public interface XmlReaderRequest
{
public interface XmlReaderRequest {
Path getPath();
@ -57,8 +54,7 @@ public interface XmlReaderRequest
boolean isAddDefaultEntities();
interface Transformer
{
interface Transformer {
/**
* Interpolate the value read from the xml document
*
@ -67,18 +63,16 @@ interface Transformer
* log stuff.
* @return the interpolated value
*/
String transform( String source, String fieldName );
String transform(String source, String fieldName);
}
@Nonnull
static XmlReaderRequestBuilder builder()
{
static XmlReaderRequestBuilder builder() {
return new XmlReaderRequestBuilder();
}
@NotThreadSafe
class XmlReaderRequestBuilder
{
class XmlReaderRequestBuilder {
Path path;
URL url;
InputStream inputStream;
@ -89,68 +83,57 @@ class XmlReaderRequestBuilder
String location;
boolean addDefaultEntities = true;
public XmlReaderRequestBuilder path( Path path )
{
public XmlReaderRequestBuilder path(Path path) {
this.path = path;
return this;
}
public XmlReaderRequestBuilder url( URL url )
{
public XmlReaderRequestBuilder url(URL url) {
this.url = url;
return this;
}
public XmlReaderRequestBuilder inputStream( InputStream inputStream )
{
public XmlReaderRequestBuilder inputStream(InputStream inputStream) {
this.inputStream = inputStream;
return this;
}
public XmlReaderRequestBuilder reader( Reader reader )
{
public XmlReaderRequestBuilder reader(Reader reader) {
this.reader = reader;
return this;
}
public XmlReaderRequestBuilder transformer( Transformer transformer )
{
public XmlReaderRequestBuilder transformer(Transformer transformer) {
this.transformer = transformer;
return this;
}
public XmlReaderRequestBuilder strict( boolean strict )
{
public XmlReaderRequestBuilder strict(boolean strict) {
this.strict = strict;
return this;
}
public XmlReaderRequestBuilder modelId( String modelId )
{
public XmlReaderRequestBuilder modelId(String modelId) {
this.modelId = modelId;
return this;
}
public XmlReaderRequestBuilder location( String location )
{
public XmlReaderRequestBuilder location(String location) {
this.location = location;
return this;
}
public XmlReaderRequestBuilder addDefaultEntities( boolean addDefaultEntities )
{
public XmlReaderRequestBuilder addDefaultEntities(boolean addDefaultEntities) {
this.addDefaultEntities = addDefaultEntities;
return this;
}
public XmlReaderRequest build()
{
return new DefaultXmlReaderRequest( path, url, inputStream, reader, transformer, strict,
modelId, location, addDefaultEntities );
public XmlReaderRequest build() {
return new DefaultXmlReaderRequest(
path, url, inputStream, reader, transformer, strict, modelId, location, addDefaultEntities);
}
private static class DefaultXmlReaderRequest implements XmlReaderRequest
{
private static class DefaultXmlReaderRequest implements XmlReaderRequest {
final Path path;
final URL url;
final InputStream inputStream;
@ -161,12 +144,17 @@ private static class DefaultXmlReaderRequest implements XmlReaderRequest
final String location;
final boolean addDefaultEntities;
@SuppressWarnings( "checkstyle:ParameterNumber" )
DefaultXmlReaderRequest( Path path, URL url, InputStream inputStream, Reader reader,
Transformer transformer, boolean strict,
String modelId, String location,
boolean addDefaultEntities )
{
@SuppressWarnings("checkstyle:ParameterNumber")
DefaultXmlReaderRequest(
Path path,
URL url,
InputStream inputStream,
Reader reader,
Transformer transformer,
boolean strict,
String modelId,
String location,
boolean addDefaultEntities) {
this.path = path;
this.url = url;
this.inputStream = inputStream;
@ -179,58 +167,48 @@ private static class DefaultXmlReaderRequest implements XmlReaderRequest
}
@Override
public Path getPath()
{
public Path getPath() {
return path;
}
@Override
public URL getURL()
{
public URL getURL() {
return null;
}
@Override
public InputStream getInputStream()
{
public InputStream getInputStream() {
return inputStream;
}
public Reader getReader()
{
public Reader getReader() {
return reader;
}
@Override
public Transformer getTransformer()
{
public Transformer getTransformer() {
return transformer;
}
@Override
public boolean isStrict()
{
public boolean isStrict() {
return strict;
}
@Override
public String getModelId()
{
public String getModelId() {
return modelId;
}
@Override
public String getLocation()
{
public String getLocation() {
return location;
}
@Override
public boolean isAddDefaultEntities()
{
public boolean isAddDefaultEntities() {
return addDefaultEntities;
}
}
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.services.MavenException;
@ -28,17 +27,13 @@
* @since 4.0
*/
@Experimental
public class XmlWriterException
extends MavenException
{
public class XmlWriterException extends MavenException {
/**
* @param message the message for the exception
* @param e the exception itself
*/
public XmlWriterException( String message, Exception e )
{
super( message, e );
public XmlWriterException(String message, Exception e) {
super(message, e);
}
}

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.services.xml;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.services.xml;
import java.io.OutputStream;
import java.io.Writer;
import java.nio.file.Path;
import org.apache.maven.api.annotations.Experimental;
/**
@ -32,8 +30,7 @@
* @param <T> the object type to read
*/
@Experimental
public interface XmlWriterRequest<T>
{
public interface XmlWriterRequest<T> {
Path getPath();
@ -43,56 +40,47 @@ public interface XmlWriterRequest<T>
T getContent();
static <T> XmlWriterRequestBuilder<T> builder()
{
static <T> XmlWriterRequestBuilder<T> builder() {
return new XmlWriterRequestBuilder<>();
}
class XmlWriterRequestBuilder<T>
{
class XmlWriterRequestBuilder<T> {
Path path;
OutputStream outputStream;
Writer writer;
T content;
public XmlWriterRequestBuilder<T> path( Path path )
{
public XmlWriterRequestBuilder<T> path(Path path) {
this.path = path;
return this;
}
public XmlWriterRequestBuilder<T> outputStream( OutputStream outputStream )
{
public XmlWriterRequestBuilder<T> outputStream(OutputStream outputStream) {
this.outputStream = outputStream;
return this;
}
public XmlWriterRequestBuilder<T> writer( Writer writer )
{
public XmlWriterRequestBuilder<T> writer(Writer writer) {
this.writer = writer;
return this;
}
public XmlWriterRequestBuilder<T> content( T content )
{
public XmlWriterRequestBuilder<T> content(T content) {
this.content = content;
return this;
}
public XmlWriterRequest<T> build()
{
return new DefaultXmlWriterRequest<>( path, outputStream, writer, content );
public XmlWriterRequest<T> build() {
return new DefaultXmlWriterRequest<>(path, outputStream, writer, content);
}
private static class DefaultXmlWriterRequest<T> implements XmlWriterRequest<T>
{
private static class DefaultXmlWriterRequest<T> implements XmlWriterRequest<T> {
final Path path;
final OutputStream outputStream;
final Writer writer;
final T content;
DefaultXmlWriterRequest( Path path, OutputStream outputStream, Writer writer, T content )
{
DefaultXmlWriterRequest(Path path, OutputStream outputStream, Writer writer, T content) {
this.path = path;
this.outputStream = outputStream;
this.writer = writer;
@ -100,26 +88,22 @@ private static class DefaultXmlWriterRequest<T> implements XmlWriterRequest<T>
}
@Override
public Path getPath()
{
public Path getPath() {
return path;
}
@Override
public OutputStream getOutputStream()
{
public OutputStream getOutputStream() {
return outputStream;
}
@Override
public Writer getWriter()
{
public Writer getWriter() {
return writer;
}
@Override
public T getContent()
{
public T getContent() {
return content;
}
}

View File

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file

View File

@ -1,5 +1,3 @@
package org.apache.maven.api.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -9,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -40,8 +39,6 @@
*/
@Experimental
@Documented
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.TYPE, ElementType.PACKAGE } )
public @interface Consumer
{
}
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.TYPE, ElementType.PACKAGE})
public @interface Consumer {}

Some files were not shown because too many files have changed in this diff Show More