|
|
|
Re: [TEXO] Problem with ClassCastException in ModelPackage [message #559280 is a reply to message #559270] |
Thu, 16 September 2010 09:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mark,
The annotationsmodel seems to be illegal xml (maybe my copy-paste). Can you enter a bugzilla and attach the files to it?
Then I can add them to the test suite.
gr. Martin
On 09/16/2010 10:47 AM, Mark Hoffmann wrote:
> Hi Martin,
>
> I looked into it a little bit. You're right the classifier id's are
> wrong. I changed it in the generated code by hand and everything works.
>
> Regarding the enum problem:
> I have an ecore with enums. I create an annotionsmodel from this ecore.
> I changed the package path, model class package path as well as the
> qualified class names for the classes and enums in the annotionsmodel.
>
> When I generate the model code, for classes everything is fine. The enum
> java code contains the annotationsmodel package definition. but the
> java-file is generated in the original folder from the standard
> defintion. It should be generated in the folder structure from the
> annotionsmodel.
>
> Further there are some wrong paths in the generated factory. You will
> see it, when you generate code from this ecore and annotationsmodel.
>
> I can send you ecore and model so i paste it here:
> ECORE:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="Person">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="address"
> lowerBound="1"
> eType="#//Address"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contacts"
> upperBound="-1"
> eType="#//Contact"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Address">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="street"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="city"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Contact">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
> eType="#//ContactType"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="ContactType">
> <eLiterals name="PHONE"/>
> <eLiterals name="EMAIL" value="1"/>
> </eClassifiers>
> </ecore:EPackage>
>
>
> Annotationsmodel:
>
> <?xml version="1.0" encoding="ASCII"?>
> <annotationsmodel:AnnotatedModel xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:annotationsmodel="http://www.eclipse.org/emf/texo/annotations/model"
> xmlns:modelannotations=" http://www.eclipse.org/emf/texo/modelgenerator/modelannotati ons">
>
> <annotatedEPackages>
> <ePackage href="test.ecore#/"/>
> <ePackageAnnotations
> xsi:type="modelannotations:EPackageModelGenAnnotation" name="test"
> packagePath="texo.test" modelClassesPackagePath="texo.test"
> qualifiedClassName="test.TestModelPackage"
> simpleClassName="TestModelPackage"
> simpleModelFactoryClassName="TestModelFactory" ecoreFileContent="<?xml
> version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="Person">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="address"
> lowerBound="1"
> eType="#//Address"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contacts"
> upperBound="-1"
> eType="#//Contact"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Address">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="street"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="city"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Contact">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
> eType="#//ContactType"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="ContactType">
> <eLiterals name="PHONE"/>
> <eLiterals name="EMAIL" value="1"/>
> </eClassifiers>
> </ecore:EPackage>
> " ecoreFileName="test.ecore"/>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Person"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Person" qualifiedClassName="texo.test.Person"
> simpleClassName="Person" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasManyFeatures="true" hasSuperEClass="false" serializable="false"
> abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Person/firstname"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation"
> name="firstname" getter="getFirstname" type="java.lang.String"
> objectType="java.lang.String" itemType="java.lang.String"
> defaultValue="null" setter="setFirstname"
> validJavaMemberName="firstname" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Person/lastname"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="lastname"
> getter="getLastname" type="java.lang.String"
> objectType="java.lang.String" itemType="java.lang.String"
> defaultValue="null" setter="setLastname" validJavaMemberName="lastname"
> many="false" useList="false" reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEReference">
> <eReference href="test.ecore#//Person/address"/>
> <eReferenceAnnotations
> xsi:type="modelannotations:EReferenceModelGenAnnotation" name="address"
> getter="getAddress" type="test.Address" objectType="test.Address"
> itemType="test.Address" defaultValue="null" setter="setAddress"
> validJavaMemberName="address" many="false" useList="false"
> reference="true"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> generateSafeManyAccess="true"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEReference">
> <eReference href="test.ecore#//Person/contacts"/>
> <eReferenceAnnotations
> xsi:type="modelannotations:EReferenceModelGenAnnotation" name="contacts"
> getter="getContacts" type="java.util.List<test.Contact>"
> objectType="java.util.List<test.Contact>" itemType="test.Contact"
> defaultValue="new java.util.ArrayList<test.Contact>()"
> setter="setContacts" validJavaMemberName="contacts" many="true"
> useList="true" reference="true"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> generateSafeManyAccess="true"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Address"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Address" qualifiedClassName="texo.test.Address"
> simpleClassName="Address" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasSuperEClass="false" serializable="false" abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Address/street"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="street"
> getter="getStreet" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setStreet"
> validJavaMemberName="street" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.1/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Address/city"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="city"
> getter="getCity" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setCity"
> validJavaMemberName="city" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.1/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Contact"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Contact" qualifiedClassName="texo.test.Contact"
> simpleClassName="Contact" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasSuperEClass="false" serializable="false" abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Contact/value"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="value"
> getter="getValue" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setValue"
> validJavaMemberName="value" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.2/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Contact/type"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="type"
> getter="getType" type="test.ContactType" objectType="test.ContactType"
> itemType="test.ContactType" defaultValue="test.ContactType.PHONE"
> setter="setType" validJavaMemberName="type" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.2/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEEnum">
> <eEnum href="test.ecore#//ContactType"/>
> <eEnumAnnotations xsi:type="modelannotations:EEnumModelGenAnnotation"
> name="ContactType" qualifiedClassName="test.ContactType"
> simpleClassName="ContactType" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> instanceClassName="texo.test.ContactType"
> objectClassName="test.ContactType" enum="true" dateType="false"
> automaticStringConversion="false" itemType="java.lang.Object"/>
> <annotatedEEnumLiterals>
> <eEnumLiteral href="test.ecore#//ContactType/PHONE"/>
> </annotatedEEnumLiterals>
> <annotatedEEnumLiterals>
> <eEnumLiteral href="test.ecore#//ContactType/EMAIL"/>
> </annotatedEEnumLiterals>
> </annotatedEClassifiers>
> </annotatedEPackages>
> </annotationsmodel:AnnotatedModel>
>
>
> Regards,
> Mark
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [TEXO] Problem with ClassCastException in ModelPackage [message #559313 is a reply to message #559296] |
Thu, 16 September 2010 11:06 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mark,
I checked the annotations model and there are some strange in there. For example the Address eclass annotation has this
eattribute:
qualifiedClassName="texo.test.Address"
however, the Person eclass has an ereference annotation for address with this eattribute:
type="test.Address"
This is the reason that there are compile errors in the generated code for the Person, as it refers to a type which does
not get generated. It is best to have a quite empty annotationsmodel (so only annotate what you want to change, the rest
is automatically generated). So to solve this I would remove all the ereference annotations.
To be sure, did you manually change the annotations model?
The reason that the ContactType enum is generated in a separate package is because its annotation has this eattribute set:
qualifiedClassName="test.ContactType"
so therefore it ends up in the test package and not in the texo.test package.
gr. Martin
On 09/16/2010 12:02 PM, Mark Hoffmann wrote:
> Hi Martin,
>
> there are two new bugs:
> - 325427 regarding the wron classifier id's
> - 325429 regarding some generation problems
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
|
|
Re: [TEXO] Problem with ClassCastException in ModelPackage [message #623218 is a reply to message #623216] |
Thu, 16 September 2010 09:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mark,
The annotationsmodel seems to be illegal xml (maybe my copy-paste). Can you enter a bugzilla and attach the files to it?
Then I can add them to the test suite.
gr. Martin
On 09/16/2010 10:47 AM, Mark Hoffmann wrote:
> Hi Martin,
>
> I looked into it a little bit. You're right the classifier id's are
> wrong. I changed it in the generated code by hand and everything works.
>
> Regarding the enum problem:
> I have an ecore with enums. I create an annotionsmodel from this ecore.
> I changed the package path, model class package path as well as the
> qualified class names for the classes and enums in the annotionsmodel.
>
> When I generate the model code, for classes everything is fine. The enum
> java code contains the annotationsmodel package definition. but the
> java-file is generated in the original folder from the standard
> defintion. It should be generated in the folder structure from the
> annotionsmodel.
>
> Further there are some wrong paths in the generated factory. You will
> see it, when you generate code from this ecore and annotationsmodel.
>
> I can send you ecore and model so i paste it here:
> ECORE:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="Person">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="address"
> lowerBound="1"
> eType="#//Address"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contacts"
> upperBound="-1"
> eType="#//Contact"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Address">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="street"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="city"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Contact">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
> eType="#//ContactType"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="ContactType">
> <eLiterals name="PHONE"/>
> <eLiterals name="EMAIL" value="1"/>
> </eClassifiers>
> </ecore:EPackage>
>
>
> Annotationsmodel:
>
> <?xml version="1.0" encoding="ASCII"?>
> <annotationsmodel:AnnotatedModel xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:annotationsmodel="http://www.eclipse.org/emf/texo/annotations/model"
> xmlns:modelannotations=" http://www.eclipse.org/emf/texo/modelgenerator/modelannotati ons">
>
> <annotatedEPackages>
> <ePackage href="test.ecore#/"/>
> <ePackageAnnotations
> xsi:type="modelannotations:EPackageModelGenAnnotation" name="test"
> packagePath="texo.test" modelClassesPackagePath="texo.test"
> qualifiedClassName="test.TestModelPackage"
> simpleClassName="TestModelPackage"
> simpleModelFactoryClassName="TestModelFactory" ecoreFileContent="<?xml
> version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="Person">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="address"
> lowerBound="1"
> eType="#//Address"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contacts"
> upperBound="-1"
> eType="#//Contact"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Address">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="street"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="city"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Contact">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
> eType="#//ContactType"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="ContactType">
> <eLiterals name="PHONE"/>
> <eLiterals name="EMAIL" value="1"/>
> </eClassifiers>
> </ecore:EPackage>
> " ecoreFileName="test.ecore"/>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Person"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Person" qualifiedClassName="texo.test.Person"
> simpleClassName="Person" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasManyFeatures="true" hasSuperEClass="false" serializable="false"
> abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Person/firstname"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation"
> name="firstname" getter="getFirstname" type="java.lang.String"
> objectType="java.lang.String" itemType="java.lang.String"
> defaultValue="null" setter="setFirstname"
> validJavaMemberName="firstname" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Person/lastname"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="lastname"
> getter="getLastname" type="java.lang.String"
> objectType="java.lang.String" itemType="java.lang.String"
> defaultValue="null" setter="setLastname" validJavaMemberName="lastname"
> many="false" useList="false" reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEReference">
> <eReference href="test.ecore#//Person/address"/>
> <eReferenceAnnotations
> xsi:type="modelannotations:EReferenceModelGenAnnotation" name="address"
> getter="getAddress" type="test.Address" objectType="test.Address"
> itemType="test.Address" defaultValue="null" setter="setAddress"
> validJavaMemberName="address" many="false" useList="false"
> reference="true"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> generateSafeManyAccess="true"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEReference">
> <eReference href="test.ecore#//Person/contacts"/>
> <eReferenceAnnotations
> xsi:type="modelannotations:EReferenceModelGenAnnotation" name="contacts"
> getter="getContacts" type="java.util.List<test.Contact>"
> objectType="java.util.List<test.Contact>" itemType="test.Contact"
> defaultValue="new java.util.ArrayList<test.Contact>()"
> setter="setContacts" validJavaMemberName="contacts" many="true"
> useList="true" reference="true"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.0/@eClassAnno tations.0 "
> generateSafeManyAccess="true"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Address"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Address" qualifiedClassName="texo.test.Address"
> simpleClassName="Address" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasSuperEClass="false" serializable="false" abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Address/street"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="street"
> getter="getStreet" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setStreet"
> validJavaMemberName="street" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.1/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Address/city"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="city"
> getter="getCity" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setCity"
> validJavaMemberName="city" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.1/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEClass">
> <eClass href="test.ecore#//Contact"/>
> <eClassAnnotations xsi:type="modelannotations:EClassModelGenAnnotation"
> name="Contact" qualifiedClassName="texo.test.Contact"
> simpleClassName="Contact" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> hasSuperEClass="false" serializable="false" abstract="false"/>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Contact/value"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="value"
> getter="getValue" type="java.lang.String" objectType="java.lang.String"
> itemType="java.lang.String" defaultValue="null" setter="setValue"
> validJavaMemberName="value" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.2/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEAttribute">
> <eAttribute href="test.ecore#//Contact/type"/>
> <eAttributeAnnotations
> xsi:type="modelannotations:EAttributeModelGenAnnotation" name="type"
> getter="getType" type="test.ContactType" objectType="test.ContactType"
> itemType="test.ContactType" defaultValue="test.ContactType.PHONE"
> setter="setType" validJavaMemberName="type" many="false" useList="false"
> reference="false"
> ownerEClassAnnotation=" //@annotatedEPackages.0/@annotatedEClassifiers.2/@eClassAnno tations.0 "
> boolean="false" primitive="false"/>
> </annotatedEStructuralFeatures>
> </annotatedEClassifiers>
> <annotatedEClassifiers xsi:type="annotationsmodel:AnnotatedEEnum">
> <eEnum href="test.ecore#//ContactType"/>
> <eEnumAnnotations xsi:type="modelannotations:EEnumModelGenAnnotation"
> name="ContactType" qualifiedClassName="test.ContactType"
> simpleClassName="ContactType" generateCode="true"
> ownerEPackageAnnotation="//@annotatedEPackages.0/@ePackageAnnotations.0 "
> instanceClassName="texo.test.ContactType"
> objectClassName="test.ContactType" enum="true" dateType="false"
> automaticStringConversion="false" itemType="java.lang.Object"/>
> <annotatedEEnumLiterals>
> <eEnumLiteral href="test.ecore#//ContactType/PHONE"/>
> </annotatedEEnumLiterals>
> <annotatedEEnumLiterals>
> <eEnumLiteral href="test.ecore#//ContactType/EMAIL"/>
> </annotatedEEnumLiterals>
> </annotatedEClassifiers>
> </annotatedEPackages>
> </annotationsmodel:AnnotatedModel>
>
>
> Regards,
> Mark
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [TEXO] Problem with ClassCastException in ModelPackage [message #623222 is a reply to message #623220] |
Thu, 16 September 2010 11:06 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mark,
I checked the annotations model and there are some strange in there. For example the Address eclass annotation has this
eattribute:
qualifiedClassName="texo.test.Address"
however, the Person eclass has an ereference annotation for address with this eattribute:
type="test.Address"
This is the reason that there are compile errors in the generated code for the Person, as it refers to a type which does
not get generated. It is best to have a quite empty annotationsmodel (so only annotate what you want to change, the rest
is automatically generated). So to solve this I would remove all the ereference annotations.
To be sure, did you manually change the annotations model?
The reason that the ContactType enum is generated in a separate package is because its annotation has this eattribute set:
qualifiedClassName="test.ContactType"
so therefore it ends up in the test package and not in the texo.test package.
gr. Martin
On 09/16/2010 12:02 PM, Mark Hoffmann wrote:
> Hi Martin,
>
> there are two new bugs:
> - 325427 regarding the wron classifier id's
> - 325429 regarding some generation problems
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.27780 seconds