View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //   Generated by Maven, any modifications will be overwritten.
3   // ==============================================================
4   package org.apache.maven.settings;
5   
6   import java.io.Serializable;
7   import java.util.AbstractList;
8   import java.util.ArrayList;
9   import java.util.Collections;
10  import java.util.HashMap;
11  import java.util.List;
12  import java.util.Map;
13  import java.util.Properties;
14  import java.util.stream.Collectors;
15  import java.util.stream.Stream;
16  import org.apache.maven.api.annotations.Generated;
17  import org.apache.maven.api.annotations.Nonnull;
18  
19  @Generated
20  public class Profile
21      extends IdentifiableBase
22      implements Serializable, Cloneable
23  {
24  
25  
26      public Profile()
27      {
28          this( org.apache.maven.api.settings.Profile.newInstance() );
29      }
30  
31      public Profile( org.apache.maven.api.settings.Profile delegate )
32      {
33          super( delegate );
34      }
35  
36      public Profile clone()
37      {
38          return new Profile( getDelegate() );
39      }
40  
41      @Override
42      public org.apache.maven.api.settings.Profile getDelegate()
43      {
44          return ( org.apache.maven.api.settings.Profile ) delegate;
45      }
46  
47      public Activation getActivation()
48      {
49          return getDelegate().getActivation() != null ? new Activation( getDelegate().getActivation() ) : null;
50      }
51  
52      public void setActivation( Activation activation )
53      {
54          delegate = getDelegate().withActivation( activation.getDelegate() );
55      }
56  
57      @Nonnull
58      public Properties getProperties()
59      {
60          return new WrapperProperties( getDelegate()::getProperties, this::setProperties );
61      }
62  
63      public void setProperties( Properties properties )
64      {
65          Map<String, String> map = properties.entrySet().stream()
66                  .collect( Collectors.toMap( e -> e.getKey().toString(), e -> e.getValue().toString() ) );
67          delegate = getDelegate().withProperties( map );
68      }
69  
70      public void addProperty( String key, String value )
71      {
72          getProperties().put( key, value );
73      }
74  
75      @Nonnull
76      public List<Repository> getRepositories()
77      {
78          return new WrapperList<Repository, org.apache.maven.api.settings.Repository>(
79                      getDelegate()::getRepositories, l -> delegate = getDelegate().withRepositories( l ),
80                      Repository::new, Repository::getDelegate );
81      }
82  
83      public void setRepositories( List<Repository> repositories )
84      {
85          delegate = getDelegate().withRepositories(
86                  repositories.stream().map( c -> c.getDelegate() ).collect( Collectors.toList() ) );
87      }
88  
89      public void addRepository( Repository repository )
90      {
91          delegate = getDelegate().withRepositories(
92                  Stream.concat( getDelegate().getRepositories().stream(), Stream.of( repository.getDelegate() ) )
93                          .collect( Collectors.toList() ) );
94      }
95  
96      @Nonnull
97      public List<Repository> getPluginRepositories()
98      {
99          return new WrapperList<Repository, org.apache.maven.api.settings.Repository>(
100                     getDelegate()::getPluginRepositories, l -> delegate = getDelegate().withPluginRepositories( l ),
101                     Repository::new, Repository::getDelegate );
102     }
103 
104     public void setPluginRepositories( List<Repository> pluginRepositories )
105     {
106         delegate = getDelegate().withPluginRepositories(
107                 pluginRepositories.stream().map( c -> c.getDelegate() ).collect( Collectors.toList() ) );
108     }
109 
110     public void addPluginRepository( Repository pluginRepository )
111     {
112         delegate = getDelegate().withPluginRepositories(
113                 Stream.concat( getDelegate().getPluginRepositories().stream(), Stream.of( pluginRepository.getDelegate() ) )
114                         .collect( Collectors.toList() ) );
115     }
116 
117     public static List<org.apache.maven.api.settings.Profile> profileToApiV4( List<Profile> list )
118     {
119         return list != null ? new WrapperList<>( list, Profile::getDelegate, Profile::new ) : null;
120     }
121 
122     public static List<Profile> profileToApiV3( List<org.apache.maven.api.settings.Profile> list )
123     {
124         return list != null ? new WrapperList<>( list, Profile::new, Profile::getDelegate ) : null;
125     }
126 
127 }