Jochen Wiedmann wrote:
On Apr 12, 2005 8:51 AM, Nacho G. Mac Dowell <[EMAIL PROTECTED]> wrote:
The issue here is how Enumerations handle this: they expect TypedValue
to do the conversion.
TypedValue was introduced recently and is not used by the enumerations.
class EnumerationSG
public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
for (int i = 0; i < values.length; i++) {
if (values[i].getValue().equals(pValue)) {
return new TypedValueImpl(qName + "." +values[i].getName(), qName);
}
}
return super.getCastFromString(pController, pValue);
}?
Besides, TypedValue should be generally treated as an opaque object, which isIf I didn't get it wrong, at the moment including TypedValue as an embeddable Java Source produces wrong output because it expects a full blown java string. IMHO if the responsability for generating a correct TypedValue is for the SG then I don't understand the need for TypedValue. How would it then be used?
embeddable into Java Source. The only exception should be the decision, whether
casting is required or not. (For example, in the list handling, where
you've got to
know, if you have a primitive integer and need to convert it into an
Integer object,
before it can be added to the list.
If needed, wouldn't it be better to use the static methods of DataTypeConverter rather than creating a new one if it doesn't come as the last parameter?
2. getCastFromString(SimpleTypeSG pController, JavaMethod pMethod,
Object pValue, Object pData) would no longer be needed?
No, it is absolutely needed, because it generates the code for
converting strings
at runtime.
Sorry if I'm asking too many questions, it's just that I'd like to see this feature done (plus help on this release ;-) ). So, to the point: if I understand you well you prefer to do the conversion on the SG rather than on TypedValue? As soon as I understand how you want this to be handled I'll submit a patch with the test case.
Nacho
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
