package com.atlassian.plugin.osgi.factory.transform.model;

import aQute.lib.header.OSGiHeader;

import java.util.Map;

public class SystemExports
{
    private final Map<String, Map<String,String>> exports;

    public SystemExports(String exportsLine)
    {
        this.exports = OSGiHeader.parseHeader(exportsLine);
    }

    public String getFullExport(String pkg)
    {
        String fullPkg = pkg;
        if (exports.containsKey(pkg))
        {
            StringBuilder sb = new StringBuilder();
            sb.append(pkg);
            Map<String,String> attrs = exports.get(pkg);
            if (attrs != null && !attrs.isEmpty())
            {
                for (Map.Entry<String,String> entry : attrs.entrySet())
                {
                    sb.append(";");
                    sb.append(entry.getKey());
                    sb.append("=\"");

                    if ("version".equals(entry.getKey()))
                    {
                        sb.append("[").append(entry.getValue()).append(",").append(entry.getValue()).append("]");
                    }
                    else
                    {
                        sb.append(entry.getValue());
                    }
                    sb.append("\"");
                }
            }
            fullPkg = sb.toString();
        }
        return fullPkg;
    }
}

@@ -113,16 +113,102 @@
 l.Map;%0A%0A
+/**%0A * Encapsulates the package exports from the system bundle%0A *%0A * @since 2.2.0%0A */%0A
 public c
@@ -296,121 +296,614 @@
     
-public SystemExports(String exportsLine)%0A    %7B%0A        this.exports = OSGiHeader.parseHeader(exportsLine);%0A    %7D%0A
+/**%0A     * Constructs an instance by parsing the exports line from the manifest%0A     *%0A     * @param exportsLine The Export-Package header value%0A     */%0A    public SystemExports(String exportsLine)%0A    %7B%0A        this.exports = OSGiHeader.parseHeader(exportsLine);%0A    %7D%0A%0A    /**%0A     * Constructs a package export, taking into account any attributes on the system export, including the version.%0A     * The version is handled special, in that is added as an exact match, i.e. %5B1.0,1.0%5D.%0A     *%0A     * @param pkg The java package%0A     * @return The full export line to use for a host component import%0A     */
 %0A   

Add missing javadoc on SystemExports