What?
There are various reasons when we have to wrap java exceptions. Often those reasons are called: Checked Exceptions. According to the definition there are 2 types of exceptions: Continue reading
What?
There are various reasons when we have to wrap java exceptions. Often those reasons are called: Checked Exceptions. According to the definition there are 2 types of exceptions: Continue reading
There are two options to store parameters in web.xml:
– context parameters – available to the entire scope of the web application
– init parameters – available in the context of a servlet or filter in the web application
I just took the Google Collections Library and start playing with it. I discovered a class I needed in many and many situations in the past. I’m talking about Multimap. Actually Multimap is an interface having a few classes implementing it. Along with some other interfaces it comes to fulfill a gap in the Java Collections. Continue reading
[digg-reddit-me] Google Guice is a an open source Java framework released by Google under Apache License 2.0. Guice is a light weight Inversion of Control Container. It does what Spring does regarding dependency inversion aspect, without using xml files. Guide uses annotations and requires Java 1.5 or above and follows the Google philosophy of being really easy to use.
Ant is a build tool written in Java, intended to be used for Java build processes. Ant is used for building small and large projects as well. You can use ant not only for automation of building Java projects, but for automating any complicated and repetitive tasks. Ant is using xml files to define tasks that should be run during a process. Continue reading
There is a pretty common situation to use a java classes generator and to create classes based on a defined pattern. Hibernate, Castor, Jaxb are a few examples. I prefer to have those classes packed in a separate jar file. Since they are generated files it’s not a good practice to modify them, so there is not need to have them in your project. Debugging is the case when you need the source of generated classes. In this case you can simply attach the jar containing sources in your IDE (eclipse supports it, I think other IDE support it either). Continue reading
Java or .NET languages does not allow multiple inheritance and usually we don’t need multiple inheritance in our projects. However there are cases when inheriting from multiple classes is a necessity. There are a few tricks we can apply in order to be able to get what multiple inheritance gives us in the languages where it is supported. Continue reading
Lets take this time in consideration a real life project. Most of the time Ant is used to compile and build java projects. This means generating, compiling and building jar files. For this we are going to define severals tasks. Lets consider the we create a buid.xml file in the directory where sources are located. The sources are put in the subdirectory called src. We also need to include a jar in the classpath while compiling. We are going to create a separate property file to define the location of this file: Continue reading
This is the ant task I’m using to generate POJO and mapping files from a DB Schema (mysql). Continue reading
I was looking recently for some java framework to save some objects in xml files. Until now I’ve tested from a noob perspective 2 frameworks: JAXB and Castor. Don’t get misleaded by my judgment because I didn’t use any of them very deep.
I was playing with JAXB some time ago and at that time I’ve seen some interesting features there. I’ve created an XSL schema file and I’ve then generated some files. The generated classes were not some simple POJO files. They contain some annotations specifying the names of the tag and attributes in the XML file. I know this technique from .NET, where I’ve used it for some time and I consider it great(but it comes with a big disadvantage – you can not use some existing classes unless you change them and add annotations).
JAXB is not a single framework, it is a part of the Sun JWSDP – Java Web Services Developer Pack (Java WSDP) 2.0
Continue reading