You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2003/09/08 15:57:21 UTC
cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt XMLIntrospector.java
rdonkin 2003/09/08 06:57:21
Modified: betwixt/src/java/org/apache/commons/betwixt
XMLIntrospector.java
Log:
ClassNormalizer is a strategy allowing the Class introspected to differ from the class of the bean.
Revision Changes Path
1.24 +31 -2 jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java
Index: XMLIntrospector.java
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XMLIntrospector.java 27 Jul 2003 18:47:39 -0000 1.23
+++ XMLIntrospector.java 8 Sep 2003 13:57:21 -0000 1.24
@@ -84,6 +84,7 @@
import org.apache.commons.betwixt.strategy.DefaultPluralStemmer;
import org.apache.commons.betwixt.strategy.NameMapper;
import org.apache.commons.betwixt.strategy.PluralStemmer;
+import org.apache.commons.betwixt.strategy.ClassNormalizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -132,6 +133,9 @@
/** The strategy used to convert bean type names into element names */
private NameMapper elementNameMapper;
+ /** Strategy normalizes the Class of the Object before introspection */
+ private ClassNormalizer classNormalizer = new ClassNormalizer();
+
/**
* The strategy used to convert bean type names into attribute names
* It will default to the normal nameMapper.
@@ -193,6 +197,30 @@
}
+ /**
+ * Gets the <code>ClassNormalizer</code> strategy.
+ * This is used to determine the Class to be introspected
+ * (the normalized Class).
+ *
+ * @return the <code>ClassNormalizer</code> used to determine the Class to be introspected
+ * for a given Object.
+ */
+ public ClassNormalizer getClassNormalizer() {
+ return classNormalizer;
+ }
+
+ /**
+ * Sets the <code>ClassNormalizer</code> strategy.
+ * This is used to determine the Class to be introspected
+ * (the normalized Class).
+ *
+ * @param classNormalizer the <code>ClassNormalizer</code> to be used to determine
+ * the Class to be introspected for a given Object.
+ */
+ public void setClassNormalizer(ClassNormalizer classNormalizer) {
+ this.classNormalizer = classNormalizer;
+ }
+
/**
* Is <code>XMLBeanInfo</code> caching enabled?
*
@@ -245,7 +273,8 @@
} else {
// normal bean so normal introspection
- return introspect( bean.getClass() );
+ Class normalClass = getClassNormalizer().getNormalizedClass( bean );
+ return introspect( normalClass );
}
}