You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2023/06/27 13:43:44 UTC

[maven-site] branch feature/clarify-plexus-component-collection-injection created (now eb53e371)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch feature/clarify-plexus-component-collection-injection
in repository https://gitbox.apache.org/repos/asf/maven-site.git


      at eb53e371 Clarify collection implementations being injected

This branch includes the following new commits:

     new eb53e371 Clarify collection implementations being injected

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-site] 01/01: Clarify collection implementations being injected

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/clarify-plexus-component-collection-injection
in repository https://gitbox.apache.org/repos/asf/maven-site.git

commit eb53e371bfc9068b14a67263c3b431d4ba713b5c
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Jun 27 15:43:39 2023 +0200

    Clarify collection implementations being injected
---
 .../apt/guides/mini/guide-configuring-plugins.apt    | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/content/apt/guides/mini/guide-configuring-plugins.apt b/content/apt/guides/mini/guide-configuring-plugins.apt
index 91f1b9e5..cb52a269 100644
--- a/content/apt/guides/mini/guide-configuring-plugins.apt
+++ b/content/apt/guides/mini/guide-configuring-plugins.apt
@@ -309,11 +309,11 @@ public class MyAnimalMojo
  Where each of the animals listed would be entries in the <<<animals>>> field. Unlike arrays, collections do not necessarily have
   a specific component type. In order to derive the type of a collection item, the following strategy is used:
 
-  [[1]] If the XML element contains an <<<implementation>>> hint attribute, try to load the class with the given fully qualified class name from the attribute value
+  [[1]] If the first item XML element contains an <<<implementation>>> hint attribute, try to load the class with the given fully qualified class name from the attribute value
 
-  [[2]] If the XML element contains a <<<.>>>, try to load the class with the fully qualified class name given in the element name
+  [[2]] If the first item XML element contains a <<<.>>>, try to load the class with the fully qualified class name given in the element name
 
-  [[3]] Try the XML element name (with capitalized first letter) as a class in the same package as the mojo/object being
+  [[3]] Try the first item XML element name (with capitalized first letter) as a class in the same package as the mojo/object being
         configured
 
   [[4]] Use the parameter type information from either
@@ -324,6 +324,18 @@ public class MyAnimalMojo
 
   []
 
+ The following collection implementations are being used when there is no <<<implementation>>> hint attribute in the XML element representing the collection:
+ 
+*---------------------*--------------*
+|| Collection Class   || Used for
+*---------------------*--------------*
+<<<TreeSet>>>   | for all types assignable to <<<SortedSet>>>
+*---------------------*--------------*
+<<<HashSet>>>   | for all types assignable to <<<Set>>>
+*---------------------*--------------*
+<<<ArrayList>>> | for every other <<<Collection>>> type which is not a <<<Map>>>
+*---------------------*--------------*
+ 
  Since Maven 3.3.9 ({{{https://issues.apache.org/jira/browse/MNG-5440}MNG-5440}}), you can list individual items alternatively as comma-separated list in the XML value of animals directly.
  This approach is also used if configuring collection/array parameters via command line
  The following example is equivalent to the example above:
@@ -381,6 +393,8 @@ public class MyAnimalMojo
  
  In contrast to value objects and collections/arrays there is no string coercion defined for maps, i.e. you cannot give parameters of that type via CLI argument. 
 
+ The map implementation class is by default <<<TreeMap>>> but can be overridden with an <<<implementation>>> attribute on the XML element representing the map.
+  
 **** {Mapping Properties}
 
  Properties should be defined like the following: