• Category Archives: Java

Java specific articles

Automatically generating an immutable value object implementation for Interface.

While refining my Type Safe Fluent Builder pattern implementation I wanted a way to materialize an Interface without having to write all the boilerplate code related to value objects and having huge constructors or lots of closure like inner class implementation scoped temporary variables that were not immutable and the like I decided I needed… Read the full article

Obfuscating String contents in Java to make reverse engineering just a little bit more effort.

As I was reverse engineering some proprietary Java code that I only had the binaries for. Being able to view the .class files as hex and see the plain text contents of all the String objects made it much easier to figure out what was going on. This reminded me of a simple but old… Read the full article

How to interactively read user input from System.in using java.util.Scanner?

There seems to be dozens of new questions about how to use `Scanner` on Stackoverflow every day. All of them duplicates of the hundreds of questions already asked about how to use this class and it is confusing API. Probably some new text book this year is causing this torrent of craptastic questions from anonymous… Read the full article

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