Package org.oddjob.io

Class FilesType

java.lang.Object
org.oddjob.io.FilesType
All Implemented Interfaces:
Serializable, ArooaValue

public class FilesType extends Object implements ArooaValue, Serializable
Author:
Rob Gordon.
See Also:

Description

Specify files using a wild card pattern, or a list. The list can contain FileType or other types that can be converted into a java File object or array including this type. In this way this type can be used to build complicated collections of files.

Example

A single file.

<files files="onefile.txt"/>
Using a wildcard expression.

<files files="reports/*.txt"/>
Specifying a list of files.

<files>

    <list>

        <files files="onefile.txt"/>

        <files files="reports/*.txt"/>

    </list>

</files>
A complex version of building up a file list. It includes taking advantage of Oddjob's built in path conversion and adds in files specified as arguments passed in to Oddjob.

<oddjob id="this">

    <job>

        <sequential>

            <jobs>

                <variables id="vars">

                    <aList>

                        <files>

                            <list>

                                <file file="a.jar"/>

                                <value value="b.jar${path.separator}c.jar"/>

                                <value value="${this.args}"/>

                            </list>

                        </files>

                    </aList>

                </variables>

                <foreach>

                    <values>

                        <value value="${vars.aList}"/>

                    </values>

                    <configuration>

                        <xml>

                            <foreach id="loop">

                                <job>

                                    <echo>${loop.current}</echo>

                                </job>

                            </foreach>

                        </xml>

                    </configuration>

                </foreach>

            </jobs>

        </sequential>

    </job>

</oddjob>
  • Field Details

    • A_FEW

      public static int A_FEW
  • Constructor Details

    • FilesType

      public FilesType()
  • Method Details

    • setFiles

      public void setFiles(String files)
      The file pattern.
      Parameters:
      files - The file pattern.
    • getFiles

      public String getFiles()
    • setList

      public void setList(int index, File[] files)
    • toFiles

      public File[] toFiles() throws IOException
      Find all the files .
      Returns:
      An array of files.
      Throws:
      IOException - if anything goes wrong.
    • toString

      public String toString()
      Overrides:
      toString in class Object