Java Tag

On June 26th we will release Tabris 1.4. Currently we are working on the new features for this release. One of the Killer-Features, a tracking API for the Tabris UI framework, was finished last week. The API comes with a ready-to-use Google Analytics integration. All you need to do is set your tracking ID and activate it. In your code this might look like this: [raw] ...

Read More

If you still find yourself defining methods like this public String[] getParameters(); in an interface, you should think again. Arrays are not just old-fashioned, there are good reasons to avoid exposing them. In this article, I'll try to summarize the main drawbacks of using arrays in Java APIs. [ Looking for more tips on writing clean code? See our Software Craftsmanship page. | Polish up your coding with...

Read More

As you might have noticed, Java 8 was released last week ;). Most programers consider Java 8 the biggest change to the Java programming language ever made. This is mostly because of lambda expressions, default methods and streams. As an SWT/RAP/Tabris coder, the first thing that came to my mind was: "How can this make my SWT code better?". This blog will show you how to...

Read More

Here is a widespread way of creating a label with a bold font: [raw] Label label = new Label(shell, SWT.NONE); Font boldFont = new Font( label.getDisplay(), new FontData( "Arial", 12, SWT.BOLD ) ); label.setFont( boldFont ); label.setText("Bold Label"); [/raw] Everything seems to be fine with this code. A Label is created with the default font "Arial", the default size "12" and our desired style "BOLD". So what's the problem with this snippet? With the...

Read More

Most of the server-side Java systems I built over the last years had the following requirements: They should be modular to be highly extendable and of course they should have a REST API to lower the integration barrier for other systems. If you have similar requirements you probably choose two standards/technologies. For the modular part it's definitely OSGi at the moment and for the REST API part...

Read More

Today we are proud to release the OSGi JAX-RS Connector 3.2. A lot has happened since the 3.1 release back in October 2013. This post will give you an overview of the new and noteworthy things included in the 3.2 release. We upgraded the underlying Jersey library to 2.5 which was released back in December. We also included the bundles needed for multipart formdata requests. Bryan Hunt...

Read More

Earlier this year I've introduced Minimal JSON, a slim and fast Java library for reading and writing JSON. In contrast to object mappers such as Gson or Jackson, Minimal JSON does not more than reading a JSON text into a memory-efficient Java representation that can be accessed, modified and serialized to JSON again. You can see some code examples on the project page. We're using this...

Read More

[caption id="" align="alignright" width="320"] Image via CC from Alexei Kuznetsov[/caption]Probably every Java developer has developed at least one String utility class in his life. Need a proof? Feed "java StringUtil" to your favorite search engine - I found 20 different implementations among the first 30 search hits only! There is a simple reason for that - Strings are used quite frequently in common Java programs...

Read More