In previous reply I raised two concerns:

Patrik Nordwall wrote:
> 
> One tricky thing is that the DSL elements are not one-to-one to java and
> it is often ambiguous where to place the annotation in the generated code.
> Do we need some kind of additional placement hint for the annotation?
> 
> Do we add to much power to the DSL? Is it possible to solve in some other
> other way?
> 

I think I have a better suggestion.
I the DSL we can add hint="...any string..."
The users can define what to generate using the ordinary oAW AOP mechanism.
An example:
    Entity Foo {
        String name hint="xml"
        -...@country country hint="transient"
    }

In SpecialCases.xpt
«AROUND templates::DomainObject::jpaAnnotations FOR Attribute»
    «IF hint="xml"»
        @javax.xml.bind.annotation.XmlElement(required=true«IF nullable»,
nillable=true«ENDIF»)
    «ENDIF»
«ENDAROUND»

«AROUND templates::DomainObject::oneReferenceJpaAnnotations FOR Reference»
    «IF hint="transient"»
        @javax.persistence.Transient
    «ELSE»
        «targetDef.proceed()»
    «ENDIF»
«ENDAROUND»

This is not limited to annotations. It is an useful improvement of existing
customization mechanism.

We will add more "hook" definitions in the templates when requested, and we
can initially make sure we have good hooks for typical annotations.

What do you think?

/Patrik

-- 
View this message in context: 
http://www.nabble.com/New-concept-tp24252062s17564p24266526.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to