Example usage for org.apache.commons.digester3 Digester addCallMethod

List of usage examples for org.apache.commons.digester3 Digester addCallMethod

Introduction

In this page you can find the example usage for org.apache.commons.digester3 Digester addCallMethod.

Prototype

public void addCallMethod(String pattern, String methodName, int paramCount, Class<?> paramTypes[]) 

Source Link

Document

Add an "call method" rule for the specified parameters.

Usage

From source file:net.sf.mcf2pdf.mcfglobals.McfProductCatalogue.java

private static McfProductCatalogue readV6(InputStream in) throws IOException, SAXException {
    Digester digester = new Digester();
    digester.addObjectCreate("description", McfProductCatalogueImpl.class);
    digester.addObjectCreate("description/product", McfAlbumTypeImpl.class);
    DigesterUtil.addSetProperties(digester, "description/product", getAlbumSpecialAttributes());
    DigesterUtil.addSetProperties(digester, "description/product/usablesize", getUsableSizeAttributes());
    digester.addCallMethod("description/product/spines/spine", "addSpine", 2,
            new String[] { Integer.class.getName(), Integer.class.getName() });
    digester.addCallParam("description/product/spines/spine", 0, "pages");
    digester.addCallParam("description/product/spines/spine", 1, "width");
    digester.addSetNext("description/product", "addAlbumType");

    return digester.parse(in);
}

From source file:net.sf.mcf2pdf.mcfglobals.McfProductCatalogue.java

public static McfProductCatalogue read(InputStream in, CatalogueVersion version)
        throws IOException, SAXException {
    if (version == CatalogueVersion.V6) {
        return readV6(in);
    }/*  w w  w  . ja v a 2s. c om*/

    // PRE_V6
    Digester digester = new Digester();
    digester.addObjectCreate("fotobookdefinitions", McfProductCatalogueImpl.class);
    digester.addObjectCreate("fotobookdefinitions/album", McfAlbumTypeImpl.class);
    DigesterUtil.addSetProperties(digester, "fotobookdefinitions/album", getAlbumSpecialAttributes());
    DigesterUtil.addSetProperties(digester, "fotobookdefinitions/album/usablesize", getUsableSizeAttributes());
    digester.addCallMethod("fotobookdefinitions/album/spines/spine", "addSpine", 2,
            new String[] { Integer.class.getName(), Integer.class.getName() });
    digester.addCallParam("fotobookdefinitions/album/spines/spine", 0, "pages");
    digester.addCallParam("fotobookdefinitions/album/spines/spine", 1, "width");
    digester.addSetNext("fotobookdefinitions/album", "addAlbumType");

    return digester.parse(in);
}