Package org.apache.ant.cyclonedx
Class FilesystemOnlyMappedResourceCollection
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.types.DataType
-
- org.apache.ant.cyclonedx.FilesystemOnlyMappedResourceCollection
-
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<org.apache.tools.ant.types.Resource>,org.apache.tools.ant.types.ResourceCollection
public final class FilesystemOnlyMappedResourceCollection extends org.apache.tools.ant.types.DataType implements org.apache.tools.ant.types.ResourceCollectionA variant ofMappedResourceCollectionthat only accepts file-system resource collections as children and which returns resources that provide access to the underlying files (unlikeMappedResourceCollectionwhich prevents direct access.It wraps another resource collection and maps their names using the provided mapper when returning the resources.
This type should not be used with arbitrary Ant tasks as the tasks may use the underlying File's name instead of the mapped name when iterating over the resources. It is useful when used with
ComponentBomTask's pure file components as all that is used there is the mapped name and the content of the actual file (to calculate hashes).- Since:
- CycloneDX Antlib 0.2
-
-
Constructor Summary
Constructors Constructor Description FilesystemOnlyMappedResourceCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(org.apache.tools.ant.types.ResourceCollection c)Adds the resources to map.voidadd(org.apache.tools.ant.util.FileNameMapper fileNameMapper)Creates a nested mapper by directly providing the implementation.org.apache.tools.ant.types.MappercreateMapper()Creates a nested mapper.booleanisFilesystemOnly()java.util.Iterator<org.apache.tools.ant.types.Resource>iterator()intsize()-
Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes, toString
-
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
-
-
-
Method Detail
-
add
public void add(org.apache.tools.ant.types.ResourceCollection c) throws org.apache.tools.ant.BuildExceptionAdds the resources to map.- Parameters:
c- the resources- Throws:
org.apache.tools.ant.BuildException
-
createMapper
public org.apache.tools.ant.types.Mapper createMapper() throws org.apache.tools.ant.BuildExceptionCreates a nested mapper.- Returns:
- a mapper instance that can be used to configure filename mapping
- Throws:
org.apache.tools.ant.BuildException
-
add
public void add(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
Creates a nested mapper by directly providing the implementation.- Parameters:
fileNameMapper- the mapper to use
-
isFilesystemOnly
public boolean isFilesystemOnly()
- Specified by:
isFilesystemOnlyin interfaceorg.apache.tools.ant.types.ResourceCollection
-
iterator
public java.util.Iterator<org.apache.tools.ant.types.Resource> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<org.apache.tools.ant.types.Resource>
-
size
public int size()
- Specified by:
sizein interfaceorg.apache.tools.ant.types.ResourceCollection
-
-