• Category Archives: Java

Java specific articles

CheckedExceptions are an unnecessary anti-pattern!

The argument rages on still to this day about checked exceptions in Java. Personally I think they have always been a bad idea. Python gets along fine without checked exceptions, and I love me some Python. The Java developers don’t even get the concept of checked exceptions correct most of the time and the SDK… Read the full article

Jackson 2.x javax.management.ObjectName Custom JSON Serializer

The following is the source code for a javax.management.ObjectName serializer that recursively serializes and is a good example of how to avoid circular references. This is specifically aimed at dumping the DomainRuntimeServiceMBean and the RuntimeServiceMBean servers from Weblogic 11g, but it should work with any JMX standards compliant MBServer implementations.

Enforcing Fluent API adherence using Interfaces in Java

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… Read the full article

Releasing Maven Artifacts to Central Repository through Sonatype

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… Read the full article

A Generic Object Oriented replacement for large Switch / Case and If / Else statements in Java

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… Read the full article

close