Class 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.ResourceCollection
    A variant of MappedResourceCollection that only accepts file-system resource collections as children and which returns resources that provide access to the underlying files (unlike MappedResourceCollection which 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
    • Field Summary

      • Fields inherited from class org.apache.tools.ant.types.DataType

        checked, ref
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(org.apache.tools.ant.types.ResourceCollection c)
      Adds the resources to map.
      void add​(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
      Creates a nested mapper by directly providing the implementation.
      org.apache.tools.ant.types.Mapper createMapper()
      Creates a nested mapper.
      boolean isFilesystemOnly()
      java.util.Iterator<org.apache.tools.ant.types.Resource> iterator()  
      int size()  
      • 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface org.apache.tools.ant.types.ResourceCollection

        isEmpty, stream
    • Constructor Detail

      • FilesystemOnlyMappedResourceCollection

        public FilesystemOnlyMappedResourceCollection()
    • Method Detail

      • add

        public void add​(org.apache.tools.ant.types.ResourceCollection c)
                 throws org.apache.tools.ant.BuildException
        Adds 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.BuildException
        Creates 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:
        isFilesystemOnly in interface org.apache.tools.ant.types.ResourceCollection
      • iterator

        public java.util.Iterator<org.apache.tools.ant.types.Resource> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<org.apache.tools.ant.types.Resource>
      • size

        public int size()
        Specified by:
        size in interface org.apache.tools.ant.types.ResourceCollection