Skip to content
Permalink
Browse files
cleanup + javadoc
  • Loading branch information
mbenson committed Mar 31, 2022
1 parent 3178af3 commit da99c88a9097e79121cf7c128a6fa155264ab60d
Showing 10 changed files with 234 additions and 79 deletions.
@@ -102,6 +102,7 @@ Predicate<String> matcher(final CompareSelect.ForStringAttribute selector) {
* Create a new {@link CompareSelect.ForStringAttribute}.
*
* @param project
* Ant {@link Project}
*/
protected ForStringAttribute(final Project project) {
super(project);
@@ -112,6 +113,7 @@ protected ForStringAttribute(final Project project) {
* Add nested text by which the value to compare is set.
*
* @param text
* to add
*/
public void addText(final String text) {
Optional.ofNullable(StringUtils.trimToNull(text)).map(getProject()::replaceProperties).map(String::trim)
@@ -122,7 +124,7 @@ public void addText(final String text) {
}

/**
* Get "match as" strategy (default {@link MatchAs#LITERAL}.
* Get "match as" strategy (default {@link MatchAs#literal}.
*
* @return {@link MatchAs}
*/
@@ -134,6 +136,7 @@ public MatchAs getMatchAs() {
* Set "match as" strategy.
*
* @param matchAs
* strategy
*/
public void setMatchAs(final MatchAs matchAs) {
Exceptions.raiseIf(matchAs == null, buildException(), "@matchas may not be null");
@@ -158,6 +161,7 @@ public final boolean isCaseSensitive() {
* Set whether matching should be performed in a case-sensitive manner.
*
* @param caseSensitive
* flag
*/
public void setCaseSensitive(final boolean caseSensitive) {
if (caseSensitive != this.caseSensitive) {
@@ -179,6 +183,7 @@ public boolean isSelected(final Resource r) {
* {@link ObjectResource}.
*
* @param obj
* owning value
* @return {@link String}
*/
protected abstract String extractValueFrom(ObjectResource obj);
@@ -217,6 +222,7 @@ public static class Bucket extends CompareSelect.ForStringAttribute {
* Create a new {@link Bucket} selector.
*
* @param project
* Ant {@link Project}
*/
public Bucket(final Project project) {
super(project);
@@ -240,6 +246,7 @@ public static class Key extends CompareSelect.ForStringAttribute {
* Create a new {@link Key} selector.
*
* @param project
* Ant {@link Project}
*/
public Key(final Project project) {
super(project);
@@ -263,6 +270,7 @@ public static class ContentType extends CompareSelect.ForStringAttribute {
* Create a new {@link ContentType} selector.
*
* @param project
* Ant {@link Project}
*/
public ContentType(final Project project) {
super(project);
@@ -287,6 +295,7 @@ public static class Meta extends CompareSelect.ForStringAttribute {
* Create a new {@link Meta} selector.
*
* @param project
* Ant {@link Project}
*/
public Meta(final Project project) {
super(project);
@@ -305,6 +314,7 @@ public String getKey() {
* Set the user metadata key to match on.
*
* @param key
* to match
*/
public void setKey(final String key) {
this.key = key;
@@ -329,6 +339,7 @@ public static class Tag extends CompareSelect.ForStringAttribute {
* Create a new {@link Tag} selector.
*
* @param project
* Ant {@link Project}
*/
public Tag(final Project project) {
super(project);
@@ -347,6 +358,7 @@ public String getKey() {
* Set the tag key to match on.
*
* @param key
* to match
*/
public void setKey(final String key) {
this.key = key;
@@ -370,11 +382,15 @@ public static class VersionId extends CompareSelect.ForStringAttribute {
* Create a new {@link VersionId} selector.
*
* @param project
* Ant {@link Project}
*/
public VersionId(Project project) {
super(project);
}

/**
* {@inheritDoc}
*/
@Override
protected String extractValueFrom(ObjectResource obj) {
return obj.getVersionId();
@@ -392,6 +408,9 @@ public static abstract class ForBooleanAttribute extends CompareSelect {
* Create a new {@link CompareSelect.ForBooleanAttribute}.
*
* @param project
* Ant {@link Project}
* @param test
* to determine truth
*/
protected ForBooleanAttribute(Project project, Predicate<ObjectResource> test) {
super(project);
@@ -425,6 +444,7 @@ public static class DeleteMarker extends CompareSelect.ForBooleanAttribute {
* Create a new {@link DeleteMarker}.
*
* @param project
* Ant {@link Project}
*/
public DeleteMarker(Project project) {
super(project, ObjectResource::isDeleteMarker);
@@ -440,6 +460,7 @@ public static class Latest extends CompareSelect.ForBooleanAttribute {
* Create a new {@link Latest}.
*
* @param project
* Ant {@link Project}
*/
public Latest(Project project) {
super(project, ObjectResource::isLatest);
@@ -458,6 +479,7 @@ public static class ByPrecision extends CompareSelect {
* Create a new {@link ByPrecision}.
*
* @param project
* Ant {@link Project}
*/
public ByPrecision(Project project) {
super(project);
@@ -476,7 +498,7 @@ public Precision getPrecision() {
* Set the precision.
*
* @param precision
* Precision
* {@link Precision}
*/
public void setPrecision(Precision precision) {
this.precision = precision;
@@ -512,6 +534,7 @@ private static final <T extends Comparable<T>> Comparator<Resource> comparingS3(
* Create a {@link CompareSelect} instance.
*
* @param project
* Ant {@link Project}
*/
protected CompareSelect(Project project) {
setProject(project);
@@ -53,6 +53,16 @@ public abstract class CopyResources extends LoggingTask {
private boolean append;
private boolean preserveLastModified;

/**
* Create a new {@link CopyResources} instance.
*
* @param project
* Ant {@link Project}
*/
protected CopyResources(Project project) {
super(project);
}

/**
* {@inheritDoc}
*/
@@ -105,8 +115,9 @@ public final void execute() throws BuildException {
* Add a nested source {@link ResourceCollection}.
*
* @param sources
* to add
*/
public void add(final ResourceCollection sources) {
public void add(ResourceCollection sources) {
this.sources.add(sources);
}

@@ -131,7 +142,7 @@ public Mapper createMapper() {
* @param fileNameMapper
* the {@link FileNameMapper} to add
*/
public void add(final FileNameMapper fileNameMapper) {
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}

@@ -148,8 +159,9 @@ public String getInputEncoding() {
* Set the input encoding.
*
* @param inputEncoding
* to set
*/
public void setInputEncoding(final String inputEncoding) {
public void setInputEncoding(String inputEncoding) {
this.inputEncoding = inputEncoding;
}

@@ -166,8 +178,9 @@ public String getOutputEncoding() {
* Set the output encoding.
*
* @param outputEncoding
* to set
*/
public void setOutputEncoding(final String outputEncoding) {
public void setOutputEncoding(String outputEncoding) {
this.outputEncoding = outputEncoding;
}

@@ -184,8 +197,9 @@ public boolean isFiltering() {
* Set whether global Ant filters should be applied to copy operations.
*
* @param filtering
* flag
*/
public void setFiltering(final boolean filtering) {
public void setFiltering(boolean filtering) {
this.filtering = filtering;
}

@@ -224,8 +238,9 @@ public boolean isOverwrite() {
* Set whether up-to-date target {@link Resource}s should be overwritten.
*
* @param overwrite
* flag
*/
public void setOverwrite(final boolean overwrite) {
public void setOverwrite(boolean overwrite) {
this.overwrite = overwrite;
}

@@ -248,15 +263,16 @@ public boolean isEnableMultipleMappings() {
* be copied to.
*
* @param enableMultipleMappings
* flag
*/
public void setEnableMultipleMappings(final boolean enableMultipleMappings) {
public void setEnableMultipleMappings(boolean enableMultipleMappings) {
this.enableMultipleMappings = enableMultipleMappings;
}

/**
* Learn whether target {@link Resource} content should be appended.
*
* @return
* @return {@code boolean}
*/
public boolean isAppend() {
return append;
@@ -266,8 +282,9 @@ public boolean isAppend() {
* Set whether target {@link Resource} content should be appended.
*
* @param append
* flag
*/
public void setAppend(final boolean append) {
public void setAppend(boolean append) {
this.append = append;
}

@@ -285,8 +302,9 @@ public boolean isPreserveLastModified() {
* Set whether to preserve last modified time on target {@link Resource}s.
*
* @param preserveLastModified
* flag
*/
public void setPreserveLastModified(final boolean preserveLastModified) {
public void setPreserveLastModified(boolean preserveLastModified) {
this.preserveLastModified = preserveLastModified;
}

@@ -302,13 +320,17 @@ public void setPreserveLastModified(final boolean preserveLastModified) {
* {@link FilterSetCollection} and {@code filterChains}.
*
* @param source
* {@link Resource}
* @param dest
* {@link Resource}
* @param filters
* {@link FilterSetCollection}
* @param filterChains
* @throws IOException
* {@link Vector} of {@link FilterChain}
* @throws IOException on error
*/
protected void copyResource(final Resource source, final Resource dest, final FilterSetCollection filters,
final Vector<FilterChain> filterChains) throws IOException {
protected void copyResource(Resource source, Resource dest, FilterSetCollection filters,
Vector<FilterChain> filterChains) throws IOException {
ResourceUtils.copyResource(source, dest, filters, filterChains, isOverwrite(), isPreserveLastModified(),
isAppend(), getInputEncoding(), getOutputEncoding(), getProject());
}
@@ -52,18 +52,12 @@ public class Delete extends LoggingTask {
private Precision as = Precision.object;
private int blockSize = DEFAULT_BLOCK_SIZE;

/**
* Create a new {@link Delete} task instance.
*/
public Delete() {
super();
}

/**
* Create a new {@link Delete} task instance bound to the specified
* {@link Project}.
*
* @param project
* Ant {@link Project}
*/
public Delete(Project project) {
super(project);
@@ -98,6 +92,7 @@ public void setAs(Precision as) {
* Add a configured {@link Client}.
*
* @param s3
* {@link Client}
*/
public void addConfigured(final Client s3) {
if (this.s3 != null) {
@@ -110,6 +105,7 @@ public void addConfigured(final Client s3) {
* Set the {@link Client} by reference.
*
* @param refid
* of {@link Client}
*/
public void setClientRefid(final String refid) {
Objects.requireNonNull(StringUtils.trimToNull(refid), "@clientrefid must not be null/empty/blank");
@@ -121,6 +117,7 @@ public void setClientRefid(final String refid) {
* Add a nested {@link ResourceCollection}.
*
* @param coll
* {@link ResourceCollection}
*/
public synchronized void addConfigured(ResourceCollection coll) {
Exceptions.raiseIf(coll == null, IllegalArgumentException::new, "null %s",
@@ -140,6 +137,7 @@ public synchronized void addConfigured(ResourceCollection coll) {
* Add by reference a {@link ResourceCollection} to delete.
*
* @param refid
* of {@link ResourceCollection}
*/
public void setRefid(Reference refid) {
addConfigured(refid.<ResourceCollection> getReferencedObject(getProject()));

0 comments on commit da99c88

Please sign in to comment.