I see, you are also solving problems during sleeping ;-).

This way we should avoid problems with class/package mapping. However
we have to find mechanism for parameterizing hints e.g.:
hit="xml(default='', nilIsEmpty=true),transient"

If we can use parameters in templates directly than is fine. Like:
 «AROUND templates::DomainObject::jpaAnnotations FOR Attribute»
    «IF hint="xml"»
        @javax.xml.bind.annotation.XmlElement(required=true«IF
getHintParam(hints, "xml", "default") != null»,
defaultValue=getHintParam(hints, "xml", "default")«ENDIF»)
        «targetDef.proceed()»
    «ENDIF»
 «ENDAROUND»

I really like your idea because with this we can have "high order
annotations" when hint on entity can change also generation of
attributes or associated entities.
Than we need only good documentation for hints.

Pavel


On Tue, Jun 30, 2009 at 7:56 AM, Patrik
Nordwall<patrik.nordw...@gmail.com> wrote:
>
> 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
>

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

Reply via email to