FileDocCategorySizeDatePackage
ExtensionAdapter.javaAPI DocApache Ant 1.707755Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.taskdefs.optional.extension

ExtensionAdapter

public class ExtensionAdapter extends org.apache.tools.ant.types.DataType
Simple class that represents an Extension and conforms to Ants patterns.
ant.datatype
name="extension"

Fields Summary
private String
extensionName
The name of the optional package being made available, or required.
private DeweyDecimal
specificationVersion
The version number (dotted decimal notation) of the specification to which this optional package conforms.
private String
specificationVendor
The name of the company or organization that originated the specification to which this optional package conforms.
private String
implementationVendorID
The unique identifier of the company that produced the optional package contained in this JAR file.
private String
implementationVendor
The name of the company or organization that produced this implementation of this optional package.
private DeweyDecimal
implementationVersion
The version number (dotted decimal notation) for this implementation of the optional package.
private String
implementationURL
The URL from which the most recent version of this optional package can be obtained if it is not already installed.
Constructors Summary
Methods Summary
public voidsetExtensionName(java.lang.String extensionName)
Set the name of extension.

param
extensionName the name of extension

        verifyNotAReference();
        this.extensionName = extensionName;
    
public voidsetImplementationUrl(java.lang.String implementationURL)
Set the implementationURL of extension.

param
implementationURL the implementationURL of extension

        verifyNotAReference();
        this.implementationURL = implementationURL;
    
public voidsetImplementationVendor(java.lang.String implementationVendor)
Set the implementationVendor of extension.

param
implementationVendor the implementationVendor of extension

        verifyNotAReference();
        this.implementationVendor = implementationVendor;
    
public voidsetImplementationVendorId(java.lang.String implementationVendorID)
Set the implementationVendorID of extension.

param
implementationVendorID the implementationVendorID of extension

        verifyNotAReference();
        this.implementationVendorID = implementationVendorID;
    
public voidsetImplementationVersion(java.lang.String implementationVersion)
Set the implementationVersion of extension.

param
implementationVersion the implementationVersion of extension

        verifyNotAReference();
        this.implementationVersion = new DeweyDecimal(implementationVersion);
    
public voidsetRefid(org.apache.tools.ant.types.Reference reference)
Makes this instance in effect a reference to another ExtensionAdapter 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 (null != extensionName
            || null != specificationVersion
            || null != specificationVendor
            || null != implementationVersion
            || null != implementationVendorID
            || null != implementationVendor
            || null != implementationURL) {
            throw tooManyAttributes();
        }
        // change this to get the objects from the other reference
        Object o = reference.getReferencedObject(getProject());
        if (o instanceof ExtensionAdapter) {
            final ExtensionAdapter other = (ExtensionAdapter) o;
            extensionName = other.extensionName;
            specificationVersion = other.specificationVersion;
            specificationVendor = other.specificationVendor;
            implementationVersion = other.implementationVersion;
            implementationVendorID = other.implementationVendorID;
            implementationVendor = other.implementationVendor;
            implementationURL = other.implementationURL;
        } else {
            final String message =
                reference.getRefId() + " doesn\'t refer to a Extension";
            throw new BuildException(message);
        }

        super.setRefid(reference);
    
public voidsetSpecificationVendor(java.lang.String specificationVendor)
Set the specificationVendor of extension.

param
specificationVendor the specificationVendor of extension

        verifyNotAReference();
        this.specificationVendor = specificationVendor;
    
public voidsetSpecificationVersion(java.lang.String specificationVersion)
Set the specificationVersion of extension.

param
specificationVersion the specificationVersion of extension

        verifyNotAReference();
        this.specificationVersion = new DeweyDecimal(specificationVersion);
    
ExtensiontoExtension()
Convert this adpater object into an extension object.

return
the extension object

        if (null == extensionName) {
            final String message = "Extension is missing name.";
            throw new BuildException(message);
        }

        String specificationVersionString = null;
        if (null != specificationVersion) {
            specificationVersionString = specificationVersion.toString();
        }
        String implementationVersionString = null;
        if (null != implementationVersion) {
            implementationVersionString = implementationVersion.toString();
        }
        return new Extension(extensionName,
                              specificationVersionString,
                              specificationVendor,
                              implementationVersionString,
                              implementationVendor,
                              implementationVendorID,
                              implementationURL);
    
public java.lang.StringtoString()
a debug toString method.

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

        return "{" + toExtension().toString() + "}";
    
private voidverifyNotAReference()

        if (isReference()) {
            throw tooManyAttributes();
        }