Quantcast
Channel: T. C. Mits 108 » java
Browsing all 36 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Spring Framework’s ModelAndView word

I was a doing a little Spring MVC a few weeks ago, reading the docs, yet again. One thing that irked me a bit with Spring is the “ModelAndView” term. Couldn’t they have found a better word to capture...

View Article



Image may be NSFW.
Clik here to view.

Simple Java Data File

In a prior post “A very simple data file metaformat” I presented an idea for an INI type of file and used an example implementation in the Groovy language. I rewrote it in Java. One change was the use...

View Article

Image may be NSFW.
Clik here to view.

Java JMockIt mocks via Spring DI

How to use Dependency Injected mock objects to allow Integration Testing of a Java application. When working with some legacy code bases, the introduction of Dependency Injection has limitations. Thus,...

View Article

Image may be NSFW.
Clik here to view.

Java Generics Example: Jar Manifest

How do you write a generic filter that can be used while iterating a data file? On the way to listing the Jar manifest file I decided to hone my skills with Generics. Jar metadata A Java jar file is...

View Article

Image may be NSFW.
Clik here to view.

List sorting using topological ordering of a digraph

By creating a pseudo weighted directed graph on a list of elements, it is possible to apply graph algorithms to the sorting problem. This offers an alternative to approaches such as QuickSort or Merge...

View Article


Image may be NSFW.
Clik here to view.

Semantic Versioning of software components?

Saw that Apache Isis is adopting “Semantic Versioning” The SamVer doc states that, of course, it is not a new thing, just more rigor. Interesting that OSGI already had a Semantic Versioning position....

View Article

Image may be NSFW.
Clik here to view.

Java testing using XStream, AspectJ, Vsdf

Problem A unit or integration test may require the creation of complex object structures. This is even more problematic in legacy systems that were not created with testability in mind. Faced with...

View Article

Image may be NSFW.
Clik here to view.

Java Reflection Method Invoke Using Fluent Interface

Here is an example of creating a fluent builder interface for invoking a method via Java Reflection. While the code to invoke Java methods via reflection is not complex, it can be improved. We can...

View Article


Image may be NSFW.
Clik here to view.

In Eclipse, search for all text in current file?

Many good editors, especially graphical based ones, allow the user to search the current file for all occurrences of a text string. Some will offer to highlight the text, others will use a search...

View Article


Image may be NSFW.
Clik here to view.

JMockIt method not found in type when using Invocation arg

Strange I was writing a very simple JUnit test using JMockIt. But, it has a compile error. I wanted to also invoke the original mocked target object in the test. In the state based Mockup API one does...

View Article

Image may be NSFW.
Clik here to view.

Changing Java Logging Levels At Runtime

How to control Java Logger runtime levels? There are many approaches and each logging framework has their own peculiarities. This information is readily available, but surprisingly not many examples...

View Article

Image may be NSFW.
Clik here to view.

Testing Groovy with Nested Test Classes

The Groovy language allows testing with inline code, it provides the built-in JUnit, Mock, stubs, and other support. Presented here are two simple ways of embedding a JUnit test class inside a Groovy...

View Article

Image may be NSFW.
Clik here to view.

Parsing files using Groovy closures

At work I recently created a Groovy automation script that parsed FTP log files and generated a web based report. This script was then added as a scheduled job in the open-source Jenkins continuous...

View Article


Image may be NSFW.
Clik here to view.

Use truthy falsey booleans in Java

Some scripting languages such as PHP, JavaScript, and Groovy allow the use of object reference in a conditional context. They have a standard boolean coercion for certain objects or references,...

View Article

Image may be NSFW.
Clik here to view.

JGit Examples?

On a StackOverflow question asking about example source code, one answer pointed to a very good resource: jgit-cookbook. JGit is a lightweight pure Java library implementing the Git version control...

View Article


Image may be NSFW.
Clik here to view.

Java ‘hello world’ using RxJava library

A simple RxJava example that uses an array of strings and combines them to create the traditional first program. RxJava is a NetFlix open source library that they developed as part of optimizing their...

View Article

Image may be NSFW.
Clik here to view.

Set Java console output to “fine” logging level

While coding a Java module I used java.util.logging output at the INFO level in the code to help development. This info is useful only during development. Are these output statements removed when...

View Article


Image may be NSFW.
Clik here to view.

Unable to dock detached Eclipse Console window

When the Eclipse IDE ‘breaks’ it seems to be unfixable. Like right now. I detached the Console view window via dragging onto another monitor. Done with it. Now I can’t dock the Console again inside the...

View Article

Image may be NSFW.
Clik here to view.

Enum to Switch on Class types in Java and Groovy

The Java Switch statement is usually considered a code smell since it’s use can be eliminated by better use of Object Oriented Programming (OOP) design. Nowhere is this more apparent than with a...

View Article

Image may be NSFW.
Clik here to view.

Groovy template fails if language keywords used

While using the SimpleTemplateEngine to process a template with a “$package” expression I got an error. Rename this expression to “$pack” and it works. Puzzling. Then I looked at the source code for...

View Article
Browsing all 36 articles
Browse latest View live




Latest Images