You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Ias <ia...@hotmail.com> on 2004/05/31 17:05:10 UTC

An example for JAM

I made an example for JAM at http://www.apache.org/~ias/jam-example.zip,
which can be built with Ant 1.6.1 and Tiger beta 2. Here's several things
I'd like to point out.

1. Setter

"public void setId(int id)" doesn't work. Instead "public void setid(int
id)" works. (can be a bug, but anyway acceptable.)

2. Registering Proxy for javadoc

Currently, there's no method for registering Proxy for javadoc tag to
JamServiceParams, so I can't get a right result from javadoc-commented
source codes with JAM.

3. Complex and enumerated types along with javadoc

Suppose that we have annotation types below,

@interface Test {
  enum Test3 {ONE, TWO, THREE};
  String[] names();
  Test2 test2();
  Test3 test3();
}

@interface Test2 {
  int value1();
  boolean value2();
}

how can we express a Test annotation based on them in javadoc comments? I
imagine that

/**
  @Test names={"a", "b", "c"}  test2=[value1=3 value2=true] test3=ONE
*/

while JAM now considers values from javadoc as java.lang.String in
JavadocTagParser.

Thanks,

Ias

=========================================================
Lee, Changshin (Korean name)
Ias (International name)
               Company Web Site: http://www.tmax.co.kr
               Personal Web Site: http://www.iasandcb.pe.kr
---------------------------------------------------------
JSR 201, 204, 222 and 224 Expert Group Member
Apache Web Services Project Member
R&D Center
Tmax Soft, Inc.
=========================================================

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: An example for JAM

Posted by Patrick Calahan <pc...@bea.com>.
Hi Ias - thanks for the feedback!

At 12:05 AM 6/1/2004 +0900, Ias wrote:
>I made an example for JAM at http://www.apache.org/~ias/jam-example.zip,
>which can be built with Ant 1.6.1 and Tiger beta 2. Here's several things

Cool - looks like you're digging right in there.  I'm curious to know more 
about your use case for JAM.  ?

Also, just a heads up: I'm still in the process of extricating JAM from 
xbeans - it's eventually going to end up as a separate project.


>I'd like to point out.
>
>1. Setter
>
>"public void setId(int id)" doesn't work. Instead "public void setid(int
>id)" works. (can be a bug, but anyway acceptable.)

So, here are you talking about how JAM recognizes JProperties on a 
JClass?  By default, JAM scans the class looking for getter and setter 
methods conforming to the java bean spec.  So in your DeveloperProxy class, 
the id() method is not going to be recognized as a getter:

     public String id() {
         return id;
     }
     public void setid(String id) {
         this.id = id;
     }

However, I believe it should recognize the setter - it should create a 
write-only JProperty named 'id'.  I think it is a bug if that is not happening.

Note also that you can override the property scanning behavior.  You need 
to call

   JamServiceParams.setPropertyInitializer()

and give it an MVisitor in which you override the visit(MClass) method to 
scan the class and addNewProperty as appropriate.  (Sorry, I know this 
isn't doc'ed right now - on my to-do list).



>2. Registering Proxy for javadoc
>
>Currently, there's no method for registering Proxy for javadoc tag to
>JamServiceParams, so I can't get a right result from javadoc-commented
>source codes with JAM.

Yes, sorry, I've been reworking the way javadoc tags a little bit - I'll 
have some more documentation on this shortly, will let you know.


>3. Complex and enumerated types along with javadoc
>
>Suppose that we have annotation types below,
>
>
>how can we express a Test annotation based on them in javadoc comments? I
>imagine that
>
>/**
>   @Test names={"a", "b", "c"}  test2=[value1=3 value2=true] test3=ONE
>*/
>
>while JAM now considers values from javadoc as java.lang.String in
>JavadocTagParser.

Right, that is the default behavior.  If you are able to infer more typing 
information about your javadoc tags than JAM can, you can call 
JamServiceParams.setJavadocTagParser() to plug in your own parsing 
logic.  (Sorry this is also not doc'ed well, also on my to-do list).


-p



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: An example for JAM

Posted by Patrick Calahan <pc...@bea.com>.
Hi Ias - thanks for the feedback!

At 12:05 AM 6/1/2004 +0900, Ias wrote:
>I made an example for JAM at http://www.apache.org/~ias/jam-example.zip,
>which can be built with Ant 1.6.1 and Tiger beta 2. Here's several things

Cool - looks like you're digging right in there.  I'm curious to know more 
about your use case for JAM.  ?

Also, just a heads up: I'm still in the process of extricating JAM from 
xbeans - it's eventually going to end up as a separate project.


>I'd like to point out.
>
>1. Setter
>
>"public void setId(int id)" doesn't work. Instead "public void setid(int
>id)" works. (can be a bug, but anyway acceptable.)

So, here are you talking about how JAM recognizes JProperties on a 
JClass?  By default, JAM scans the class looking for getter and setter 
methods conforming to the java bean spec.  So in your DeveloperProxy class, 
the id() method is not going to be recognized as a getter:

     public String id() {
         return id;
     }
     public void setid(String id) {
         this.id = id;
     }

However, I believe it should recognize the setter - it should create a 
write-only JProperty named 'id'.  I think it is a bug if that is not happening.

Note also that you can override the property scanning behavior.  You need 
to call

   JamServiceParams.setPropertyInitializer()

and give it an MVisitor in which you override the visit(MClass) method to 
scan the class and addNewProperty as appropriate.  (Sorry, I know this 
isn't doc'ed right now - on my to-do list).



>2. Registering Proxy for javadoc
>
>Currently, there's no method for registering Proxy for javadoc tag to
>JamServiceParams, so I can't get a right result from javadoc-commented
>source codes with JAM.

Yes, sorry, I've been reworking the way javadoc tags a little bit - I'll 
have some more documentation on this shortly, will let you know.


>3. Complex and enumerated types along with javadoc
>
>Suppose that we have annotation types below,
>
>
>how can we express a Test annotation based on them in javadoc comments? I
>imagine that
>
>/**
>   @Test names={"a", "b", "c"}  test2=[value1=3 value2=true] test3=ONE
>*/
>
>while JAM now considers values from javadoc as java.lang.String in
>JavadocTagParser.

Right, that is the default behavior.  If you are able to infer more typing 
information about your javadoc tags than JAM can, you can call 
JamServiceParams.setJavadocTagParser() to plug in your own parsing 
logic.  (Sorry this is also not doc'ed well, also on my to-do list).


-p



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/