class PDAppearanceEntry implements COSObjectable
{
    private COSDictionary entry;

    private PDAppearanceEntry()
    {
    }

    /**
     * Constructor for reading.
     * 
     * @param entry the dictionary of the appearance entry
     */
    public PDAppearanceEntry(COSDictionary entry)
    {
        this.entry = entry;
    }

    @Override
    public COSDictionary getCOSObject()
    {
        return entry;
    }

    /**
     * Returns true if this entry is an appearance subdictionary.
     * 
     * @return true if this entry is an appearance subdictionary
     */
    public boolean isSubDictionary()
    {
        return !(this.entry instanceof COSStream);
    }

    /**
     * Returns true if this entry is an appearance stream.
     * 
     * @return true if this entry is an appearance stream
     */
    public boolean isStream()
    {
        return this.entry instanceof COSStream;
    }

    /**
     * Returns the entry as an appearance stream.
     *
     * @return the entry as an appearance stream
     * 
     * @throws IllegalStateException if this entry is not an appearance stream
     */
    public PDAppearanceStream getAppearanceStream()
    {
        if (!isStream())
        {
            throw new IllegalStateException("This entry is not an appearance stream");
        }
        return new PDAppearanceStream((COSStream) entry);
    }

    /**
     * Returns the entry as an appearance subdictionary.
     *
     * @return the entry as an appearance subdictionary
     * 
     * @throws IllegalStateException if this entry is not an appearance subdictionary
     */
    public Map<COSName, PDAppearanceStream> getSubDictionary()
    {<FILL_FUNCTION_BODY>}
}

        if (!isSubDictionary())
        {
            throw new IllegalStateException("This entry is not an appearance subdictionary");
        }

        COSDictionary dict = entry;
        Map<COSName, PDAppearanceStream> map = new HashMap<>();

        for (COSName name : dict.keySet())
        {
            COSStream stream = dict.getCOSStream(name);
            // the file from PDFBOX-1599 contains /null as its entry, so we skip non-stream entries
            if (stream != null)
            {
                map.put(name, new PDAppearanceStream(stream));
            }
        }
        return new COSDictionaryMap<>(map, dict);
    
<no_super_class>