Class MappedResource
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Resource
org.apache.tools.ant.types.resources.ResourceDecorator
org.apache.tools.ant.types.resources.MappedResource
- All Implemented Interfaces:
Cloneable, Comparable<Resource>, Iterable<Resource>, ResourceCollection
A decorator around a different resource that uses a mapper to
dynamically remap the resource's name.
Strips the FileProvider interface from decorated resources since it may be used to circumvent name mapping.
- Since:
- Ant 1.8.0
-
Field Summary
Fields inherited from class Resource
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZEFields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TSuppress FileProviderbooleanEquality check based on the resource's name in addition to the resource itself.getName()Maps the name.inthashCode()Get the hash code for this Resource.voidNot really supported since mapper is never null.toString()Get the string representation of this Resource.Methods inherited from class ResourceDecorator
addConfigured, compareTo, dieOnCircularReference, getInputStream, getLastModified, getOutputStream, getResource, getSize, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setSizeMethods inherited from class Resource
asOptional, clone, getMagicNumber, getRef, iterator, size, toLongStringMethods inherited from class DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributesMethods inherited from class ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface ResourceCollection
isEmpty, stream
-
Constructor Details
-
MappedResource
Wraps an existing resource.- Parameters:
r- Resource to wrapm- FileNameMapper that handles mapping
-
-
Method Details
-
getName
Maps the name.- Overrides:
getNamein classResourceDecorator- Returns:
- the name of the wrapped resource.
-
setRefid
Not really supported since mapper is never null.- Overrides:
setRefidin classResourceDecorator- Parameters:
r- reference to set
-
as
Suppress FileProvider- Overrides:
asin classResourceDecorator- Type Parameters:
T- desired type- Parameters:
clazz- the type to implement- Returns:
- resource of a desired type
-
hashCode
public int hashCode()Get the hash code for this Resource.- Overrides:
hashCodein classResourceDecorator- Returns:
- hash code as int.
- Since:
- Ant 1.8.1
-
equals
-
toString
-