class PDDestination implements PDDestinationOrAction
{

    /**
     * This will create a new destination depending on the type of COSBase
     * that is passed in.
     *
     * @param base The base level object.
     *
     * @return A new destination.
     *
     * @throws IOException If the base cannot be converted to a Destination.
     */
    public static PDDestination create( COSBase base ) throws IOException
    {<FILL_FUNCTION_BODY>}

}

        PDDestination retval = null;
        if( base == null )
        {
            //this is ok, just return null.
        }
        else if (base instanceof COSArray 
                && ((COSArray) base).size() > 1 
                && ((COSArray) base).getObject(1) instanceof COSName)
        {
            COSArray array = (COSArray) base;
            COSName type = (COSName) array.getObject(1);
            String typeString = type.getName();
            switch (typeString)
            {
                case PDPageFitDestination.TYPE:
                case PDPageFitDestination.TYPE_BOUNDED:
                    retval = new PDPageFitDestination(array);
                    break;
                case PDPageFitHeightDestination.TYPE:
                case PDPageFitHeightDestination.TYPE_BOUNDED:
                    retval = new PDPageFitHeightDestination(array);
                    break;
                case PDPageFitRectangleDestination.TYPE:
                    retval = new PDPageFitRectangleDestination(array);
                    break;
                case PDPageFitWidthDestination.TYPE:
                case PDPageFitWidthDestination.TYPE_BOUNDED:
                    retval = new PDPageFitWidthDestination(array);
                    break;
                case PDPageXYZDestination.TYPE:
                    retval = new PDPageXYZDestination(array);
                    break;
                default:
                    throw new IOException("Unknown destination type: " + type.getName());
            }
        }
        else if( base instanceof COSString )
        {
            retval = new PDNamedDestination( (COSString)base );
        }
        else if( base instanceof COSName )
        {
            retval = new PDNamedDestination( (COSName)base );
        }
        else
        {
            throw new IOException( "Error: can't convert to Destination " + base );
        }
        return retval;
    
<no_super_class>