1
2
3
4 package org.apache.maven.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.Objects;
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
18 @Generated
19 public class Extension
20 extends BaseObject
21 {
22
23 public Extension()
24 {
25 this( org.apache.maven.api.model.Extension.newInstance() );
26 }
27
28 public Extension( org.apache.maven.api.model.Extension delegate )
29 {
30 this( delegate, null );
31 }
32
33 public Extension( org.apache.maven.api.model.Extension delegate, BaseObject parent )
34 {
35 super( delegate, parent );
36 }
37
38 public Extension clone()
39 {
40 return new Extension( getDelegate() );
41 }
42
43 public org.apache.maven.api.model.Extension getDelegate()
44 {
45 return ( org.apache.maven.api.model.Extension ) super.getDelegate();
46 }
47
48 public String getGroupId()
49 {
50 return getDelegate().getGroupId();
51 }
52
53 public void setGroupId( String groupId )
54 {
55 if ( !Objects.equals( groupId, getDelegate().getGroupId() ) )
56 {
57 update( getDelegate().withGroupId( groupId ) );
58 }
59 }
60
61 public String getArtifactId()
62 {
63 return getDelegate().getArtifactId();
64 }
65
66 public void setArtifactId( String artifactId )
67 {
68 if ( !Objects.equals( artifactId, getDelegate().getArtifactId() ) )
69 {
70 update( getDelegate().withArtifactId( artifactId ) );
71 }
72 }
73
74 public String getVersion()
75 {
76 return getDelegate().getVersion();
77 }
78
79 public void setVersion( String version )
80 {
81 if ( !Objects.equals( version, getDelegate().getVersion() ) )
82 {
83 update( getDelegate().withVersion( version ) );
84 }
85 }
86
87 public InputLocation getLocation( Object key )
88 {
89 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
90 return loc != null ? new InputLocation( loc ) : null;
91 }
92
93 public void setLocation( Object key, InputLocation location )
94 {
95 update( org.apache.maven.api.model.Extension.newBuilder( getDelegate(), true )
96 .location( key, location.toApiLocation() ).build() );
97 }
98
99 protected boolean replace( Object oldDelegate, Object newDelegate )
100 {
101 if ( super.replace( oldDelegate, newDelegate ) )
102 {
103 return true;
104 }
105 return false;
106 }
107
108 public static List<org.apache.maven.api.model.Extension> extensionToApiV4( List<Extension> list )
109 {
110 return list != null ? new WrapperList<>( list, Extension::getDelegate, Extension::new ) : null;
111 }
112
113 public static List<Extension> extensionToApiV3( List<org.apache.maven.api.model.Extension> list )
114 {
115 return list != null ? new WrapperList<>( list, Extension::new, Extension::getDelegate ) : null;
116 }
117
118
119
120
121
122
123 public boolean equals( Object o )
124 {
125 if ( this == o )
126 {
127 return true;
128 }
129
130 if ( !( o instanceof Extension ) )
131 {
132 return false;
133 }
134
135 Extension e = (Extension) o;
136
137 if ( !equal( e.getArtifactId(), getArtifactId() ) )
138 {
139 return false;
140 }
141 else if ( !equal( e.getGroupId(), getGroupId() ) )
142 {
143 return false;
144 }
145 else if ( !equal( e.getVersion(), getVersion() ) )
146 {
147 return false;
148 }
149 return true;
150 }
151
152 private static <T> boolean equal( T obj1, T obj2 )
153 {
154 return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
155 }
156
157
158
159
160 public int hashCode()
161 {
162 int result = 17;
163 result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
164 result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
165 result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
166 return result;
167 }
168
169
170 }