Getting concrete java generic class used in sub classes

It is funny that you need to do wacky stuff like this in order to get the class of T used in subclasses when you make generics classes like <T extends SomClass>: private Class getGenericClass() { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); Class clazz = (Class) pt.getActualTypeArguments()[0]; return clazz; } What is even more funny is that the information is clearly stored in the classes at runtime, so why the wacky code to get hold of the concrete class used? I know this information is not used to do rumtime type check and so on. But some time you need to get access the the type (class) declared in the generic sub classes. For instance if you want to load some data using JPA getEntityManager().find(someEntityClass, anId). Using T.class or some thing like that would be lovely instead of the wacky code above.

Classes in Seam 2 hot folder makes page load real slow

Seam 2 hot deploy is cool. It make sure that all seam beans in the hot folder is reloaded if changed. All Seam beans in the src/hot folder get reloaded runtime by seam, unless they are annoteted with @BypassInterceptors. This is cool compared to restarting the server. But as you add classes to the hot folder it gets slower and slower to reload a page, and by the time you reach 400+ it added about 4-10 seconds to every page call. Of cause this only apply to the development build of seam, because in the live configuration all classes end up in the same normal non hot deploy folder and causes no problem. The solution for me was to move all classes from hot  to the main folder, and then have JRebel take care of the class reloading. This have the added value JRebel can reload all classes, even seam beans annotated with @BypassInterceptors. It works like a charm, and the new version 5 is dead easy to set up in eclipse.

Code syntax highlighter in blogger blogspot

Syntax highlighting is working! There are a lot of blogs on this, but this is what I needed to do to get it to work: Like every one else I use the fantastic SyntaxHighlighter  by Alex Gorbatchev. To get it to work for me I had to host the scripts from  SyntaxHighlighter  my self. Loading it as described at  did not work for me. It resulted in a redirect that the browser couldn't handle. Any way, with that in place, I could configure the theme to load the files. This was done by Template > Edit HTML in the blogger admin page. This yield a warning that you have to be careful and know what you are doing. So I was careful while I added: <link href='http://A_HOST/syntaxhighlighter/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://A_HOST/syntaxhighlighter/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='ht