FileDocCategorySizeDatePackage
ExtensionSet.javaAPI DocApache Ant 1.704429Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.extension

ExtensionSet

public class ExtensionSet extends org.apache.tools.ant.types.DataType
The Extension set lists a set of "Optional Packages" / "Extensions".
ant.datatype
name="extension-set"

Fields Summary
private final ArrayList
extensions
ExtensionAdapter objects representing extensions.
private final ArrayList
extensionsFilesets
Filesets specifying all the extensions wanted.
Constructors Summary
Methods Summary
public voidaddExtension(ExtensionAdapter extensionAdapter)
Adds an extension that this library requires.

param
extensionAdapter an extension that this library requires.


                        
         
        extensions.add(extensionAdapter);
    
public voidaddFileset(org.apache.tools.ant.types.FileSet fileSet)
Adds a set of files about which extensions data will be extracted.

param
fileSet a set of files about which extensions data will be extracted.

        extensionsFilesets.add(fileSet);
    
public voidaddLibfileset(LibFileSet fileSet)
Adds a set of files about which extensions data will be extracted.

param
fileSet a set of files about which extensions data will be extracted.

        extensionsFilesets.add(fileSet);
    
public voidsetRefid(org.apache.tools.ant.types.Reference reference)
Makes this instance in effect a reference to another ExtensionSet instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

param
reference the reference to which this instance is associated
exception
BuildException if this instance already has been configured.

        if (!extensions.isEmpty() || !extensionsFilesets.isEmpty()) {
            throw tooManyAttributes();
        }
        // change this to get the objects from the other reference
        final Object object =
            reference.getReferencedObject(getProject());
        if (object instanceof ExtensionSet) {
            final ExtensionSet other = (ExtensionSet) object;
            extensions.addAll(other.extensions);
            extensionsFilesets.addAll(other.extensionsFilesets);
        } else {
            final String message =
                reference.getRefId() + " doesn\'t refer to a ExtensionSet";
            throw new BuildException(message);
        }

        super.setRefid(reference);
    
public Extension[]toExtensions(org.apache.tools.ant.Project proj)
Extract a set of Extension objects from the ExtensionSet.

param
proj the project instance.
return
an array containing the Extensions from this set
throws
BuildException if an error occurs

        final ArrayList extensionsList = ExtensionUtil.toExtensions(extensions);
        ExtensionUtil.extractExtensions(proj, extensionsList, extensionsFilesets);
        return (Extension[]) extensionsList.toArray(new Extension[extensionsList.size()]);
    
public java.lang.StringtoString()

see
java.lang.Object#toString()
return
the extensions in a string.

        return "ExtensionSet" + Arrays.asList(toExtensions(getProject()));