Class AntUtils


  • public class AntUtils
    extends Object
    Set of common Ant utility methods.
    • Constructor Detail

      • AntUtils

        public AntUtils​(AntTaskFactory factory)
        Parameters:
        factory - Ant task factory class used when creating Ant tasks
    • Method Detail

      • createAntTask

        public org.apache.tools.ant.Task createAntTask​(String taskName)
        Creates and returns a new instance of the Ant task mapped to the specified logical name.
        Parameters:
        taskName - The logical name of the task to create
        Returns:
        A new instance of the task
      • createSysProperty

        public org.apache.tools.ant.types.Environment.Variable createSysProperty​(String key,
                                                                                 File file)
        Convenience method to create an Ant environment variable that points to a file.
        Parameters:
        key - The key or name of the variable
        file - The file the variable should point to
        Returns:
        The created environment variable
      • createSysProperty

        public org.apache.tools.ant.types.Environment.Variable createSysProperty​(String key,
                                                                                 org.apache.tools.ant.types.Path path)
        Convenience method to create an Ant environment variable that contains a path.
        Parameters:
        key - The key or name of the variable
        path - The path
        Returns:
        The created environment variable
      • createSysProperty

        public org.apache.tools.ant.types.Environment.Variable createSysProperty​(String key,
                                                                                 String value)
        Convenience method to create an Ant environment variable that contains a string.
        Parameters:
        key - The key or name of the variable
        value - The value
        Returns:
        The created environment variable
      • createSysProperty

        public org.apache.tools.ant.types.Environment.Variable createSysProperty​(String key,
                                                                                 URI value)

        Convenience method to create an Ant environment variable that contains a string from an URI.

        Note that URI.getPath() will be used.

        Parameters:
        key - The key or name of the variable
        value - The URI to take the value from; URI.getPath() will be used
        Returns:
        The created environment variable
      • createProject

        public org.apache.tools.ant.Project createProject()
        Returns:
        a default empty Ant Project
      • addTokenToFilterChain

        public void addTokenToFilterChain​(org.apache.tools.ant.types.FilterChain filterChain,
                                          String key,
                                          String value)
        Add a token to an existing filter chain.
        Parameters:
        filterChain - the filter chain to augment
        key - the token key
        value - the token value
      • addTokensToFilterChain

        public void addTokensToFilterChain​(org.apache.tools.ant.types.FilterChain filterChain,
                                           Map<String,​String> map)
        Add the map of tokens to the filterChain.
        Parameters:
        filterChain - The filterchain to use
        map - The map