class OverlayPDF implements Callable<Integer>
{
    // Expected for CLI app to write to System.out/System.err
    @SuppressWarnings("squid:S106")
    private final PrintStream SYSERR;

    @Option(names = "-odd", description = "overlay file used for odd pages")
    private File oddPageOverlay;

    @Option(names = "-even", description = "overlay file used for even pages")
    private File evenPageOverlay;

    @Option(names = "-first", description = "overlay file used for the first page")
    private File firstPageOverlay;

    @Option(names = "-last", description = "overlay file used for the last page")
    private File lastPageOverlay;

    @Option(names = "-useAllPages", description = "overlay file used for overlay, all pages are used by simply repeating them")
    private File useAllPages;

    @Option(names = "-page", description = "overlay file used for the given page number, may occur more than once")    
    Map<Integer, String> specificPageOverlayFile = new HashMap<>();

    @Option(names = {"-default"}, description = "the default overlay file")
    private File defaultOverlay;

    @Option(names = "-position", description = "where to put the overlay file: foreground or background (default: ${DEFAULT-VALUE})")    
    private Position position = Position.BACKGROUND;

    @Option(names = {"-i", "--input"}, description = "the PDF input file", required = true)
    private File infile;

    @Option(names = {"-o", "--output"}, description = "the PDF output file", required = true)
    private File outfile;

    /**
     * Constructor.
     */
    public OverlayPDF()
    {
        SYSERR = System.err;
    }

    /**
     * This will overlay a document and write out the results.
     *
     * @param args command line arguments
     */
    public static void main(final String[] args)
    {
        // suppress the Dock icon on OS X
        System.setProperty("apple.awt.UIElement", "true");

        int exitCode = new CommandLine(new OverlayPDF()).execute(args);
        System.exit(exitCode);
    }


    @Override
    public Integer call()
    {<FILL_FUNCTION_BODY>}
}

        int retcode = 0;

        Overlay overlayer = new Overlay();
        overlayer.setOverlayPosition(position);

        if (firstPageOverlay != null)
        {
            overlayer.setFirstPageOverlayFile(firstPageOverlay.getAbsolutePath());
        }

        if (lastPageOverlay != null)
        {
            overlayer.setLastPageOverlayFile(lastPageOverlay.getAbsolutePath());
        }

        if (oddPageOverlay != null)
        {
            overlayer.setOddPageOverlayFile(oddPageOverlay.getAbsolutePath());
        }

        if (evenPageOverlay != null)
        {
            overlayer.setEvenPageOverlayFile(evenPageOverlay.getAbsolutePath());
        }

        if (useAllPages != null)
        {
            overlayer.setAllPagesOverlayFile(useAllPages.getAbsolutePath());
        }

        if (defaultOverlay != null)
        {
            overlayer.setDefaultOverlayFile(defaultOverlay.getAbsolutePath());
        }

        if (infile != null)
        {
            overlayer.setInputFile(infile.getAbsolutePath());
        }


        try (PDDocument result = overlayer.overlay(specificPageOverlayFile))
        {
            result.save(outfile);
        }
        catch (IOException ioe)
        {
            SYSERR.println( "Error adding overlay(s) to PDF [" + ioe.getClass().getSimpleName() + "]: " + ioe.getMessage());
            return 4;
        }
        finally
        {
            // close the input files AFTER saving the resulting file as some 
            // streams are shared among the input and the output files
            try
            {
                overlayer.close();
            }
            catch (IOException ioe)
            {
                SYSERR.println( "Error adding overlay(s) to PDF [" + ioe.getClass().getSimpleName() + "]: " + ioe.getMessage());
                retcode = 4;
            }
        }

        return retcode;
    
<no_super_class>