summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode/stroke/parser/GenericElementParser.java')
-rw-r--r--src/com/isode/stroke/parser/GenericElementParser.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/GenericElementParser.java b/src/com/isode/stroke/parser/GenericElementParser.java
new file mode 100644
index 0000000..da961f6
--- /dev/null
+++ b/src/com/isode/stroke/parser/GenericElementParser.java
@@ -0,0 +1,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) {
+ }
+}