class FDFJavaScript implements COSObjectable
{
    private final COSDictionary dictionary;

    /**
     * Default constructor.
     */
    public FDFJavaScript()
    {
        dictionary = new COSDictionary();
    }

    /**
     * Constructor.
     *
     * @param javaScript The FDF java script.
     */
    public FDFJavaScript(COSDictionary javaScript)
    {
        dictionary = javaScript;
    }

    /**
     * Convert this standard java object to a COS object.
     *
     * @return The cos object that matches this Java object.
     */
    @Override
    public COSDictionary getCOSObject()
    {
        return dictionary;
    }

    /**
     * This will get the javascript that is executed before the import.
     *
     * @return Some javascript code.
     */
    public String getBefore()
    {
        COSBase base = dictionary.getDictionaryObject(COSName.BEFORE);
        if (base instanceof COSString)
        {
            return ((COSString) base).getString();
        }
        else if (base instanceof COSStream)
        {
            return ((COSStream) base).toTextString();
        }
        else
        {
            return null;
        }
    }

    /**
     * This will set the javascript code the will get execute before the import.
     *
     * @param before A reference to some javascript code.
     */
    public void setBefore(String before)
    {
        dictionary.setItem(COSName.BEFORE, new COSString(before));
    }

    /**
     * This will get the javascript that is executed after the import.
     *
     * @return Some javascript code.
     */
    public String getAfter()
    {
        COSBase base = dictionary.getDictionaryObject(COSName.AFTER);
        if (base instanceof COSString)
        {
            return ((COSString) base).getString();
        }
        else if (base instanceof COSStream)
        {
            return ((COSStream) base).toTextString();
        }
        else
        {
            return null;
        }
    }

    /**
     * This will set the javascript code the will get execute after the import.
     *
     * @param after A reference to some javascript code.
     */
    public void setAfter(String after)
    {
        dictionary.setItem(COSName.AFTER, new COSString(after));
    }

    /**
     * Returns the dictionary's "Doc" entry, that is, a map of key value pairs to be added to the document's JavaScript
     * name tree.
     * 
     * @return Map of named "JavaScript" dictionaries.
     */
    public Map<String, PDActionJavaScript> getDoc()
    {<FILL_FUNCTION_BODY>}

    /**
     * Sets the dictionary's "Doc" entry.
     * 
     * @param map Map of named "JavaScript" dictionaries.
     */
    public void setDoc(Map<String, PDActionJavaScript> map)
    {
        COSArray array = new COSArray();
        map.forEach((key, value) ->
        {
            array.add(new COSString(key));
            array.add(value);
        });
        dictionary.setItem(COSName.DOC, array);
    }
}

        COSArray array = dictionary.getCOSArray(COSName.DOC);
        if (array == null)
        {
            return null;
        }
        Map<String, PDActionJavaScript> map = new LinkedHashMap<>();
        for (int i = 0; i + 1 < array.size(); i += 2)
        {
            String name = array.getName(i);
            if (name != null)
            {
                COSBase base = array.getObject(i + 1);
                if (base instanceof COSDictionary)
                {
                    PDAction action = PDActionFactory.createAction((COSDictionary) base);
                    if (action instanceof PDActionJavaScript)
                    {
                        map.put(name, (PDActionJavaScript) action);
                    }
                }
            }
        }
        return map;
    
<no_super_class>