This some considerable noise on the internet about Fluent APIs and using them. There was a question on stackoverflow.com about how to enforce calling all the required methods to guarantee you fully materialize an object when using a Builder Pattern with a Fluent API approach. The appropriate way to achieve this is through Interfaces that [...]
Where is final used? There are a lot of Java developers that don’t understand the keyword final. The keyword final is one of your greatest allies in writing bug free maintainable code. It makes reading code much more deterministic and step debugging a breeze. And it makes your code side effect free. Side effects are [...]
I have released my first Maven artifacts to the Central Repository through Sonatype’s Open Source Nexus Server. You have to jump through some hoops to get everything just right to be able to release to the Sonatype Nexus repository, and I could not find all the information I needed in one place so I will [...]
Make your pom.xml dependency entry for Jasper Reports look like this If you don’t use the excludes directive you get the java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference error. <dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports</artifactId> <version>3.7.4</version> <exclusions> <exclusion> <artifactId>jdtcore</artifactId> <groupId>eclipse</groupId> </exclusion> </exclusions> </dependency>
I have created my first Maven 2 / 3 Archetype for generating command line applications that are powered by Java Simple Argument Parser ( JSAP ). Its source code lives on GitHub. I am working on getting it posted to Sonatype and synced to Central Repository.
I saw this post on StackOverflow and thought I would whip up a quick Object Oriented solution using Generics using the Chain of Responsibility Pattern. This was a quick exercise to see how it might look. There are many other ways that this could be implemented, like using Dependency Injection to supply the implementations of [...]
Sometimes you want to load data at runtime from inside a .jar file or .war file to populate at List or Map or something. Here is how to do that easily. Just make sure that your data file is in the same package along side the Class that is loading it, or refer to it [...]
I spent a great deal of time getting this to work. I could not find a single source of information on what all the needed dependencies and repositories were, so there was a lot of trial and error involved. This first version is configured for GAE 1.4.0 and GWT 2.1.1, the latest versions at the [...]
Here’s the command to install an alternative installation of Java: I installed JDK 6u22 from the executable rpm.bin file from the Oracle site. Then I ran this command to add it to the alternatives program. alternatives –install /usr/bin/java java /usr/java/jdk1.6.0_22/bin/java 99 then you just run alternatives –config java There are 3 programs which provide ‘java’. [...]
Looks like Maven 2 is pretty much inline with the generic Ant based build system I have been using for the past 8 years. So I am going to take the plunge and start using Maven 2 so I don’t have to keep maintaining my system. Less time maintaining a build system means more time [...]