Anirudh Vyas

Ranch Hand
+ Follow
since Oct 23, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anirudh Vyas

Is this book available on manning or oreilly.com by any chance?

12 years ago
For those interested, after doing some digging in JBoss EJB container implementation and some other sources such as these:
Looking for annotations, I was able to finally get around those issues!

I thought it'd be of help to people, thanks for helping me out anyways, appreciate it!
12 years ago
code ... wheres the code, I can look at JLS or JVM specs too ... It'd be helpful if you can scribble something up.



12 years ago
to OP:

Nope. If i am not mistaken (I could be and correct me if I am wrong on this), but you can't do this even by using CGLIB or by directly using ASM Object web's famous ClassVisitor ... classes have to be non-final.

Vyas
12 years ago
exactly and plus when you are trying to refactor your code to make it more OO so as to speak, this will come in handy! (I have written extensively on this here : defensive programming ... so feel free to check it out!


12 years ago
Actually i take my stmt about DI back, I think thats a flaw in java language, because technically they should have package information available at hand through which i can traverse through all classes and check for things i want to for processing.

12 years ago
Unfortunately, I think thats a basic flaw that no one sees in dependency injection, A chief premise of dependency injection is that there has to be a programmatic or xml config way to hook your classes to be managed; So essentially Convention over configuration principle is defied in that sense.


Re-question:

There's a class called Package in java API (It has some methods like Package.getPackages(), getAnnotation( ... ), isAnnotationPresent( ... ) etc, can i get all packages and then somehow reflectively get all classes annotated with @Component?

12 years ago
Good points.

I'll try things out this weekend and let ya know (Gosh its been such a crazy week ... deadlines and all); My framework's lagging behind! ... =(


Regards
12 years ago
oh and actually the way i do it right now is use the current directory to traverse through the package names, and build a string (using stringbuilder) ... with this order:

x
x.y
x.y.z
x.y.z.u
x.y.z.u.* // this is where i go through the entire directory and then finally use the file name to load the class ... something like:

Thread.currentThread().getContextClassLoader().loadClass("x.y.z.u." + currentFileName);

is this the only way?, it sure is ugly! =( I wish there was a runtime construct in java for reflecting on packages ...


Regards
12 years ago
Hi,

While working on a framework, I have to build an annotation processor that basically traverses through any package passed in, to load all the classes within the package that carry annotation say @X, I am looking for suggestions on how to do this ... any ideas? I will be sure to add your name, the link on this thread on the code that I check in ...

I just need some basic ideas ... i can work on developing my own code alright ...

Regards
12 years ago
haha, its funny because that was the first time i tried it ... lol my bad.
well then use : http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.8.tar.bz2

ya happy now Sheriff? j/k, good catch though, otherwise op would have sifted through old archives, (well i dont know, op's intelligent enough to figure it out ;) ).

Regards
12 years ago
I am not familiar with SEO that much, i'll look it up, but briefly how does that help with SEO? ...

Anyways .. let me google it, thanks!
Hi,

why do we have it like this:


on java ranch ... two links point to the same page ... ?