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