CPD Results
The following document contains the results of PMD's CPD 7.7.0.
Duplications
| File | Line |
|---|---|
| org/apache/maven/resolver/internal/ant/types/Mirror.java | 131 |
| org/apache/maven/resolver/internal/ant/types/RemoteRepository.java | 130 |
throw tooManyAttributes();
}
super.setRefid(ref);
}
/**
* Returns the identifier of this mirror.
* <p>
* The ID is typically used for identification and logging purposes. It does not affect
* repository resolution but may appear in debug output or reports to help distinguish mirrors.
* </p>
*
* <p>
* If this mirror is defined as a reference ({@code refid}), the ID is retrieved from
* the referenced {@code Mirror} instance.
* </p>
*
* @return the mirror ID, or {@code null} if not set
*
* @see #setId(String)
* @see #isReference()
*/
public String getId() {
if (isReference()) {
return getRef().getId();
}
return id;
}
/**
* Sets the identifier of the mirror.
* <p>
* The ID is optional and is primarily used for identification and logging purposes.
* It does not affect resolution behavior but can help distinguish multiple mirrors.
* </p>
*
* <p>
* This method must not be used if the mirror is defined via {@code refid}.
* </p>
*
* @param id the identifier for this mirror
*
* @see #getId()
*/
public void setId(String id) {
this.id = id;
}
/**
* Returns the URL of the mirror repository.
* <p>
* This is the base URL where artifacts will be downloaded from when a matched repository
* is redirected to this mirror. For example: {@code https://repo.example.org/mirror}.
* </p>
*
* <p>
* If this {@code Mirror} is defined as a reference ({@code refid}), the URL is resolved
* from the referenced {@code Mirror} instance.
* </p>
*
* @return the mirror repository URL, or {@code null} if not set
*
* @see #setUrl(String)
* @see #isReference()
*/
public String getUrl() {
if (isReference()) {
return getRef().getUrl();
}
return url;
}
/**
* Sets the base URL of the mirror repository.
* <p>
* This URL must be a valid repository root (e.g., {@code https://repo.example.com/maven2}).
* It is used to redirect requests from repositories matched by {@link #setMirrorOf(String)}.
* </p>
*
* <p>
* This method must not be used if the mirror is defined via {@code refid}.
* </p>
*
* @param url the URL of the mirror repository
*
* @throws org.apache.tools.ant.BuildException if this instance is a reference
*
* @see #getUrl()
*/
public void setUrl(String url) {
checkAttributesAllowed();
this.url = url;
}
/**
* Returns the layout type of the mirror repository.
* <p>
* If no type is explicitly set, this method returns {@code "default"},
* which is the standard Maven 2 layout.
* </p>
*
* <p>
* If this mirror is defined as a reference, the type is resolved from the referenced instance.
* </p>
*
* @return the repository layout type, or {@code "default"} if not specified
*
* @see #setType(String)
*/
public String getType() {
if (isReference()) {
return getRef().getType();
}
return (type != null) ? type : "default";
}
/**
* Sets the layout type of the mirror repository.
* <p>
* The default value is {@code "default"}, which corresponds to the standard Maven 2 layout.
* Other values are rarely used and typically not necessary unless working with
* custom or legacy repository formats.
* </p>
*
* <p>
* This method must not be called if this mirror is defined via {@code refid}.
* </p>
*
* @param type the layout type of the mirror repository
*
* @throws org.apache.tools.ant.BuildException if this instance is a reference
*
* @see #getType()
*/
public void setType(String type) {
checkAttributesAllowed();
this.type = type;
}
/**
* Returns the repository pattern that this mirror applies to.
* <p>
* The value is typically a pattern or comma-separated list of repository IDs,
* such as {@code *}, {@code external:*}, or {@code central,!snapshots}.
* It determines which repositories should be redirected to this mirror.
* </p>
*
* <p>
* If this {@code Mirror} is defined as a reference ({@code refid}),
* the value is retrieved from the referenced instance.
* </p>
*
* @return the {@code mirrorOf} pattern, or {@code null} if not set
*
* @see #setMirrorOf(String)
* @see #isReference()
*/
public String getMirrorOf() { | |


