Class AntUnit.ReferenceSet

  • All Implemented Interfaces:
    java.lang.Cloneable
    Enclosing class:
    AntUnit

    public static class AntUnit.ReferenceSet
    extends org.apache.tools.ant.ProjectComponent
    Defines a collection of inherited references, with an optional nested Mapper that maps them to new reference IDs in the target project.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.tools.ant.types.Mapper mapper
      maps source reference ID to target reference ID
      private java.util.ArrayList references
      references inherited from parent project by antunit scripts
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      ReferenceSet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addReference​(AntUnit.Reference reference)  
      private void copyReference​(java.lang.String oldKey, org.apache.tools.ant.Project newProject, java.lang.String newKey)
      Try to clone and reconfigure the object referenced by oldkey in the parent project and add it to the new project with the key newkey.
      void copyReferencesInto​(org.apache.tools.ant.Project newProject)
      Copy all identified references into the target project, applying any name mapping required by a nested mapper element.
      org.apache.tools.ant.types.Mapper createMapper()  
      void setMapper​(java.lang.String typeName, java.lang.String from, java.lang.String to)
      Configure a single mapper to translate reference IDs.
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • references

        private java.util.ArrayList references
        references inherited from parent project by antunit scripts
      • mapper

        private org.apache.tools.ant.types.Mapper mapper
        maps source reference ID to target reference ID
    • Constructor Detail

      • ReferenceSet

        public ReferenceSet()
    • Method Detail

      • createMapper

        public org.apache.tools.ant.types.Mapper createMapper()
      • setMapper

        public void setMapper​(java.lang.String typeName,
                              java.lang.String from,
                              java.lang.String to)
        Configure a single mapper to translate reference IDs.
        Parameters:
        typeName - the mapper type
        from - the from attribute
        to - the to attribute
      • copyReferencesInto

        public void copyReferencesInto​(org.apache.tools.ant.Project newProject)
        Copy all identified references into the target project, applying any name mapping required by a nested mapper element.
        Parameters:
        newProject - the target project to copy references into
      • copyReference

        private void copyReference​(java.lang.String oldKey,
                                   org.apache.tools.ant.Project newProject,
                                   java.lang.String newKey)
        Try to clone and reconfigure the object referenced by oldkey in the parent project and add it to the new project with the key newkey. This protects the parent project from modification by the child project.

        If we cannot clone it, copy the referenced object itself and keep our fingers crossed.

        Parameters:
        oldKey - the reference id in the current project.
        newKey - the reference id in the new project.