The Artima Developer Community
Sponsored Link

Java Buzz Forum
Giving away attributes without all of your source

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Giving away attributes without all of your source Posted: Aug 12, 2004 10:09 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Giving away attributes without all of your source
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
Joe Walnes has talked about an interesting tactic to allowing people to grab attributes (via QDox, or whatever you want), without having to give away the entire source code. This has been a problem, as (until Java 5), the attribute data is not available in the bytecode. Instead of doing something wacky like parsing the attributes into some other form which you can distribute, how about just taking out the body of the methods and turn: package stuff; public class CheeseSlicer { /** @transaction mode=isolated */ public Slice feedMe() { // some implementation specific stuff here.. don't waste your time reading it. if (System.currentTimeMillisMillis() % 2 == 0) { return new CheddarSlice(); } else { return new BrieSlice(); } } } package stuff; public class CheeseSlicer { /** @transaction mode=isolated */ public Slice feedMe(); } To do this is simple. First, QDox can be used to parse the source of a class into a JavaClass. Calling JavaClass.toString() will print out the class without the body implementations (as above). This is something done at development time and the result should be written to a file that is available at runtime. At runtime, QDox can read this file just as if it were a full-blown Java source file, making the attributes available. Simple! Lovely! :)

Read: Giving away attributes without all of your source

Topic: [Aug 4, 2004 09:36 PDT] 15 Links Previous Topic   Next Topic Topic: I live, now answer my Spring MVC question...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use