Hi Dave,
Actually what I was thinking of (although I didnt actually write it into the
in mail) was in interface that allows you to read and write the values using
friendly names enums, so that the mapping of the generated enums (a,b,c)
wold still be there but you would also have getters and setter that took the
fielndly enums

E.g 
enum Destination (US, UK ...);

interface Destination {
     Destination getDestination();
     void setDestination(Destination destination);
     boolean isSetDestination() 
     ....
}

and a static handler that does the convertion. This would enable you to
program with the schema defained (a,b,c) model or the UK/US model for the
enums

Mike 

> -----Original Message-----
> From: David Smalley [mailto:[EMAIL PROTECTED] 
> Sent: 14 October 2005 15:41
> To: [email protected]
> Subject: RE: Changing enumeration names
> 
> Thanks for the ides.
> 
> I looked at the extension interfaces, but I'm not sure how 
> they would apply.
> As I understand it, these allow me to have generated classes 
> implement my own custom interface.  The example talks about 
> doing this with methods; I suppose I could try providing an 
> interface with no methods but the static fields I would like. 
>  Maybe something like:
> 
> public interface DestinationTypeEnums
> {
>     static final DestinationType.Enum US_Domestic = DestinationType.A;
>     static final DestinationType.Enum US_Territories = 
> DestinationType.B;
>     static final DestinationType.Enum Foreign = DestinationType.C; }
> 
> I could then either specify the implementation object as null 
> or provide an empty dummy class called DestinationTypeEnumsImpl.
> 
> It might work, although I sense a circularity in there 
> somewhere.  I'll give it a try, if for no other reason than curiosity.
> 
> Dave
> 
> -----Original Message-----
> From: Mike Skells [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 14, 2005 1:00 AM
> To: [email protected]
> Subject: RE: Changing enumeration names
> 
> Could this be done with a extension interfaces 
> http://wiki.apache.org/xmlbeans/ExtensionInterfacesFeature 
> defining an extension to do the enum mapping for each enum type
> 
> Mike
> 
> > -----Original Message-----
> > From: David Smalley [mailto:[EMAIL PROTECTED]
> > Sent: 14 October 2005 02:46
> > To: [email protected]
> > Subject: RE: Changing enumeration names
> > 
> > Thanks for the response and information.  The example I 
> gave was very 
> > simple, to make clear what I wanted.  Actually, I am using 
> XMLBeans to 
> > wrap the Universal Business Language (UBL
> > 1.0) schemas, which have enumerations with nearly 100 values, for 
> > example, "30" (maps to X_30) can mean "Buyer disagrees with 
> due date" 
> > or "AF" can mean "U.S. Defense Switched Network".
> > I just don't think a comment will work, so I will be writing some 
> > scripts to do the renaming.
> > 
> > Incidentally, the definitions are contained in the schema 
> annotation 
> > elements, so a method of selecting sub elements of 
> <annotation> with 
> > XPath and injecting their content into the javadoc comments 
> would also 
> > be nice :).
> > 
> > Dave
> > 
> > -----Original Message-----
> > From: Radu Preotiuc-Pietro [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 13, 2005 6:17 PM
> > To: [email protected]
> > Subject: RE: Changing enumeration names
> > 
> > Unfortunately, the level of customization allowed by .xsdconfig is 
> > currently not finely grained enough to make it possible to rename 
> > enumeration fields, so I am afraid you are stuck using "A", "B" and 
> > "C".
> > I wouldn't go to all the trouble of changing the generated 
> code if I 
> > were you, I would just add a comment when using it.
> > 
> > Radu
> > 
> > -----Original Message-----
> > From: David Smalley [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 13, 2005 11:08 AM
> > To: XMLBeans
> > Subject: Changing enumeration names
> > 
> > 
> > I have a schema which defines the following simple type:
> > 
> > <xsd:simpleType name="DestinationType">
> >   <xsd:restriction base="xsd:normalizedString">
> >     <xsd:enumeration value="A"/>
> >     <xsd:enumeration value="B"/>
> >     <xsd:enumeration value="C"/>
> >   </xsd:restriction>
> > </xsd:simpleType>
> > 
> > This generates the appropriate java class "DestinationType" 
> with enum 
> > fields A, B, and C.  The point is, these values are 
> correct, because 
> > the document requires their use (per the schema), but 
> they're meanings 
> > are
> > actually:
> > 
> > A - US Domestic
> > B - US Territories
> > C - Foreign
> > 
> > I would rather have enum fields in the generated type like 
> > US_Domestic, US_Territories, and Foreign; in other words, 
> defined as:
> > 
> > static final Enum US_Domestic = Enum.forString("A"); static 
> final Enum 
> > US_Territories = Enum.forString("B"); static final Enum Foreign = 
> > Enum.forString("C");
> > 
> > I have looked in the FAQ and searched the mailing list.  
> The FAQ says 
> > the "xb:qname" element in an xsdconfig file can be used to map 
> > elements and attributes as well as types, but I haven't figured out 
> > how to do it or found any examples.
> > 
> > Is there any way to force scomp to rename enumerations like 
> this, or 
> > am I stuck editing the generated code and then 
> re-compiling?  Thanks 
> > in advance for any insights.
> > 
> > Dave
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to