summaryrefslogtreecommitdiffstats
blob: 470f2b2b58ab954eb04ff8e47bbc4a042bab6e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (c) 2010, Isode Limited, London, England.
 * All rights reserved.
 */
/*
 * Copyright (c) 2010, Remko Tronçon.
 * All rights reserved.
 */
package com.isode.stroke.parser;

import com.isode.stroke.elements.Element;

public class GenericElementParser<T extends Element> implements ElementParser {

    private final T element_;

    public GenericElementParser(Class c) {
        try {
            element_ =  (T) c.newInstance();
        } catch (InstantiationException ex) {
            /* Fatal */
            throw new RuntimeException(ex);
        } catch (IllegalAccessException ex) {
            /* Fatal */
            throw new RuntimeException(ex);
        }
    }


    public Element getElement() {
        return element_;
    }

    protected T getElementGeneric() {
        return element_;
    }

    public void handleStartElement(String a, String b, AttributeMap c) {
    }

    public void handleEndElement(String a, String b) {
    }

    public void handleCharacterData(String a) {
    }
}