Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Per-package customisation of generated class names?
Per-package customisation of generated class names? [message #667581] Fri, 29 April 2011 16:20 Go to next message
Trev  is currently offline Trev Friend
Messages: 3
Registered: April 2011
Junior Member
I am generating a model from an XSD schema which imports multiple
namespaces, with multiple complex types which happen to have the same
localname as other complex types (in different namespaces).

At the XSD level there are no collisions, thanks to namespaces. At the Java
classloader level there are no collisions, thanks to packages. But at the
Java source code level there are collisions which prevent the use of import
statements for more than one class with the same localname.

I would like to be able to specify a prefix (or suffix or pattern) for class
name generation within each package.

The GenPackage's Prefix property is almost what I want: the only problem is
that it only affects "several package-related classes, including package,
factory, switch, and adapter factory" but those are not the classes that are
giving me collisions.

The GenModel's InterfaceNamePattern and ClassNamePattern also are almost
what I want: the only problem is that I haven't found a way to specify
different patterns for different packages.

Is there a way to do what I want?

Thanks,
Re: Per-package customisation of generated class names? [message #667586 is a reply to message #667581] Fri, 29 April 2011 16:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Trev,

I suppose if you generate them using different GenModels you could use
the name patterns. Otherwise you can use ecore:name annotations on the
specific types that collide.


Trev wrote:
> I am generating a model from an XSD schema which imports multiple
> namespaces, with multiple complex types which happen to have the same
> localname as other complex types (in different namespaces).
>
> At the XSD level there are no collisions, thanks to namespaces. At
> the Java
> classloader level there are no collisions, thanks to packages. But at
> the
> Java source code level there are collisions which prevent the use of
> import
> statements for more than one class with the same localname.
>
> I would like to be able to specify a prefix (or suffix or pattern) for
> class
> name generation within each package.
>
> The GenPackage's Prefix property is almost what I want: the only
> problem is
> that it only affects "several package-related classes, including package,
> factory, switch, and adapter factory" but those are not the classes
> that are
> giving me collisions.
>
> The GenModel's InterfaceNamePattern and ClassNamePattern also are almost
> what I want: the only problem is that I haven't found a way to specify
> different patterns for different packages.
>
> Is there a way to do what I want?
>
> Thanks,


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XML serialization try to handle xmlns:... attributes
Next Topic:Ereference
Goto Forum:
  


Current Time: Fri Apr 26 10:43:38 GMT 2024

Powered by FUDForum. Page generated in 0.03041 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top