View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //   Generated by Maven, any modifications will be overwritten.
3   // ==============================================================
4   package org.apache.maven.toolchain.model;
5   
6   import java.io.Serializable;
7   import java.util.AbstractList;
8   import java.util.Collections;
9   import java.util.HashMap;
10  import java.util.List;
11  import java.util.Map;
12  import java.util.Properties;
13  import java.util.stream.Collectors;
14  import java.util.stream.Stream;
15  import org.apache.maven.api.annotations.Generated;
16  import org.apache.maven.api.annotations.Nonnull;
17  import org.codehaus.plexus.util.xml.Xpp3Dom;
18  
19  @Generated
20  public class ToolchainModel
21      extends TrackableBase
22      implements Serializable, Cloneable
23  {
24  
25  
26      public ToolchainModel()
27      {
28          this( org.apache.maven.api.toolchain.ToolchainModel.newInstance() );
29      }
30  
31      public ToolchainModel( org.apache.maven.api.toolchain.ToolchainModel delegate )
32      {
33          super( delegate );
34      }
35  
36      public ToolchainModel clone()
37      {
38          return new ToolchainModel( getDelegate() );
39      }
40  
41      @Override
42      public org.apache.maven.api.toolchain.ToolchainModel getDelegate()
43      {
44          return ( org.apache.maven.api.toolchain.ToolchainModel ) delegate;
45      }
46  
47      public String getType()
48      {
49          return getDelegate().getType();
50      }
51  
52      public void setType( String type )
53      {
54          delegate = getDelegate().withType( type );
55      }
56  
57      @Nonnull
58      public Properties getProvides()
59      {
60          return new WrapperProperties( getDelegate()::getProvides, this::setProvides );
61      }
62  
63      public void setProvides( Properties provides )
64      {
65          Map<String, String> map = provides.entrySet().stream()
66                  .collect( Collectors.toMap( e -> e.getKey().toString(), e -> e.getValue().toString() ) );
67          delegate = getDelegate().withProvides( map );
68      }
69  
70      public void addProvide( String key, String value )
71      {
72          getProvides().put( key, value );
73      }
74  
75      public Object getConfiguration()
76      {
77          return getDelegate().getConfiguration() != null ? new Xpp3Dom( getDelegate().getConfiguration() ) : null;
78      }
79  
80      public void setConfiguration( Object configuration )
81      {
82          delegate = getDelegate().withConfiguration( ( ( Xpp3Dom ) configuration ).getDom() );
83      }
84  
85      public static List<org.apache.maven.api.toolchain.ToolchainModel> toolchainModelToApiV4( List<ToolchainModel> list )
86      {
87          return list != null ? new WrapperList<>( list, ToolchainModel::getDelegate, ToolchainModel::new ) : null;
88      }
89  
90      public static List<ToolchainModel> toolchainModelToApiV3( List<org.apache.maven.api.toolchain.ToolchainModel> list )
91      {
92          return list != null ? new WrapperList<>( list, ToolchainModel::new, ToolchainModel::getDelegate ) : null;
93      }
94  
95  
96                  
97      /**
98       * Method hashCode.
99       *
100      * @return int
101      */
102     public int hashCode()
103     {
104         int result = 17;
105 
106         result = 37 * result + ( getType() != null ? getType().hashCode() : 0 );
107         result = 37 * result + ( getProvides() != null ? getProvides().hashCode() : 0 );
108 
109         return result;
110     } //-- int hashCode()
111 
112     /**
113      * Method equals.
114      *
115      * @param other
116      * @return boolean
117      */
118     public boolean equals( Object other )
119     {
120         if ( this == other )
121         {
122             return true;
123         }
124 
125         if ( !( other instanceof ToolchainModel ) )
126         {
127             return false;
128         }
129 
130         ToolchainModel that = (ToolchainModel) other;
131         boolean result = true;
132 
133         result = result && ( getType() == null ? that.getType() == null : getType().equals( that.getType() ) );
134         result = result && ( getProvides() == null ? that.getProvides() == null : getProvides().equals( that.getProvides() ) );
135 
136         return result;
137     } //-- boolean equals( Object )
138                 
139               
140 }