1
2
3
4
5 package org.apache.maven.model;
6
7 import java.io.Serializable;
8 import java.util.AbstractList;
9 import java.util.Collections;
10 import java.util.HashMap;
11 import java.util.List;
12 import java.util.Map;
13 import java.util.Objects;
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 RepositoryPolicy
21 extends BaseObject
22 {
23
24 public RepositoryPolicy() {
25 this(org.apache.maven.api.model.RepositoryPolicy.newInstance());
26 }
27
28 public RepositoryPolicy(org.apache.maven.api.model.RepositoryPolicy delegate) {
29 this(delegate, null);
30 }
31
32 public RepositoryPolicy(org.apache.maven.api.model.RepositoryPolicy delegate, BaseObject parent) {
33 super(delegate, parent);
34 }
35
36 public RepositoryPolicy clone(){
37 return new RepositoryPolicy(getDelegate());
38 }
39
40 public org.apache.maven.api.model.RepositoryPolicy getDelegate() {
41 return (org.apache.maven.api.model.RepositoryPolicy) super.getDelegate();
42 }
43
44 @Override
45 public boolean equals(Object o) {
46 if (this == o) {
47 return true;
48 }
49 if (o == null || !(o instanceof RepositoryPolicy)) {
50 return false;
51 }
52 RepositoryPolicy that = (RepositoryPolicy) o;
53 return Objects.equals(this.delegate, that.delegate);
54 }
55
56 @Override
57 public int hashCode() {
58 return getDelegate().hashCode();
59 }
60
61 public String getEnabled() {
62 return getDelegate().getEnabled();
63 }
64
65 public void setEnabled(String enabled) {
66 if (!Objects.equals(enabled, getEnabled())) {
67 update(getDelegate().withEnabled(enabled));
68 }
69 }
70
71 public String getUpdatePolicy() {
72 return getDelegate().getUpdatePolicy();
73 }
74
75 public void setUpdatePolicy(String updatePolicy) {
76 if (!Objects.equals(updatePolicy, getUpdatePolicy())) {
77 update(getDelegate().withUpdatePolicy(updatePolicy));
78 }
79 }
80
81 public String getChecksumPolicy() {
82 return getDelegate().getChecksumPolicy();
83 }
84
85 public void setChecksumPolicy(String checksumPolicy) {
86 if (!Objects.equals(checksumPolicy, getChecksumPolicy())) {
87 update(getDelegate().withChecksumPolicy(checksumPolicy));
88 }
89 }
90
91 public InputLocation getLocation(Object key) {
92 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
93 return loc != null ? new InputLocation(loc) : null;
94 }
95
96 public void setLocation(Object key, InputLocation location) {
97 update(org.apache.maven.api.model.RepositoryPolicy.newBuilder(getDelegate(), true)
98 .location(key, location.toApiLocation()).build());
99 }
100
101 protected boolean replace(Object oldDelegate, Object newDelegate) {
102 if (super.replace(oldDelegate, newDelegate)) {
103 return true;
104 }
105 return false;
106 }
107
108 public static List<org.apache.maven.api.model.RepositoryPolicy> repositoryPolicyToApiV4(List<RepositoryPolicy> list) {
109 return list != null ? new WrapperList<>(list, RepositoryPolicy::getDelegate, RepositoryPolicy::new) : null;
110 }
111
112 public static List<RepositoryPolicy> repositoryPolicyToApiV3(List<org.apache.maven.api.model.RepositoryPolicy> list) {
113 return list != null ? new WrapperList<>(list, RepositoryPolicy::new, RepositoryPolicy::getDelegate) : null;
114 }
115
116
117
118 public boolean isEnabled()
119 {
120 return ( getEnabled() != null ) ? Boolean.parseBoolean( getEnabled() ) : true;
121 }
122
123
124
125
126
127 public void setEnabled( boolean enabled )
128 {
129 setEnabled( String.valueOf( enabled ) );
130 }
131
132
133
134 }