rdonkin 2004/02/21 06:39:12
Modified: betwixt/src/java/org/apache/commons/betwixt/io/read Tag:
REFACTORING-BRANCH_2004-01-13
SimpleTypeBindAction.java
Log:
Refactoring to simplify algorithm
Revision Changes Path
No revision
No revision
1.1.2.3 +22 -19
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/SimpleTypeBindAction.java
Index: SimpleTypeBindAction.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/SimpleTypeBindAction.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- SimpleTypeBindAction.java 21 Feb 2004 14:22:15 -0000 1.1.2.2
+++ SimpleTypeBindAction.java 21 Feb 2004 14:39:12 -0000 1.1.2.3
@@ -80,22 +80,25 @@
public void body(String text, ReadContext context) throws Exception {
// add dyna-bean support!
// probably refactoring needed
- Class lastMappedClazz = context.getLastMappedClass();
- if (lastMappedClazz != null) {
- XMLBeanInfo lastMappedClazzInfo =
- context.getXMLIntrospector().introspect(lastMappedClazz);
- ElementDescriptor baseDescriptor =
- lastMappedClazzInfo.getElementDescriptor();
- ElementDescriptor childDescriptor =
- baseDescriptor.getElementDescriptor(
- context.getRelativeElementPathIterator());
- if (childDescriptor != null) {
- Updater updater = childDescriptor.getUpdater();
- if (updater != null) {
- updater.update(context, text);
- }
+ Updater updater = getCurrentUpdater(context);
+ if (updater != null)
+ {
+ updater.update(context, text);
+ } else {
+ if (context.getLog().isDebugEnabled())
+ {
+ context.getLog().debug("No updater for simple type '" +
context.getCurrentElement() + "'");
}
}
+ }
+
+ private Updater getCurrentUpdater(ReadContext context) throws Exception {
+ Updater result = null;
+ ElementDescriptor elementDescriptor = context.getCurrentDescriptor() ;
+ if (elementDescriptor != null) {
+ result = elementDescriptor.getUpdater();
+ }
+ return result;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]