A library with common Java types that are mostly immutable value objects.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A library with common Java types that are mostly immutable value objects.

Build Status Coverage Status Maven Central LGPLv3 License Java Development Kit 1.8


Package "common"

Base classes like utilities and general annotations.

Package "ui"

Annotations that can be placed on plain objects but may be used by a user interface to render that object in some way.

Package "vo"

Provides Value Objects and utility classes for those immutable objects.

Click here for details...

Description "common"

Base classes like utilities and general annotations.

FileExists Validator

Verifies that the file exists (Bean validation JSR 303).

private File myFile;

IsDirectory Validator

Verifies that it's a directory and not a file (Bean validation JSR 303).

private File myDir;


Marker interface for classes that provide a special representation for trace output.

public class MyClass implements TraceStringCapable {

   public String toTraceString() {
       return "A long and very detailed instance description for trace output"; 

Description "ui"

The annotations may be used by UI elements to display an appropriate text for a type or a field. You can also configure a bundle and key for internationalization.

Label annotation

Use this annotation to assign a label to a class or an attribute.

@Label(value = "Birthday", bundle = "my/MyBundle", key = "birthday.label")
private Date birthday;

Prompt annotation

Use this annotation to assign a prompt (example value) to a class or an attribute.

@Prompt(value = "12-31-1993", bundle = "my/MyBundle", key = "birthday.prompt")
private Date birthday;

ShortLabel annotation

Use this annotation to assign an abbreviation to a class or an attribute.

@ShortLabel(value = "BD", bundle = "my/MyBundle", key = "birthday.short")
private Date birthday;

TableColumn annotation

Use this annotation to assign preferred table column values to a field.

@TableColumn(pos = 3, width = 20, unit= FontSizeUnit.EM, getter = "isInternal")
private boolean permanentEmployee;

TextField annotation

Use this annotation to express the annotated attribute should be rendered as a text field. User agents are expected to use this information as hint for the rendering process.

@TextField(width = 50)
private String lastName;

Tooltip annotation

Use this annotation to assign a tooltip to a class or a field.

@Tooltip(value = "The person's birthday", bundle = "my/MyBundle", key = "birthday.tooltip")
private Date birthday;


You can use AnnotationAnalyzer to read the internationalized text from above annotations.

Read a single @Label text:

AnnotationAnalyzer analyzer = new AnnotationAnalyzer();

Field field = MyClass.class.getDeclaredField("birthday");

FieldTextInfo labelInfoGermany = analyzer.createFieldInfo(field, Locale.GERMANY, Label.class);        
// Prints "Geburtstag"

FieldTextInfo labelInfoUs = analyzer.createFieldInfo(field, Locale.US, Label.class);        
// Prints "Birthday"

Read all @Label texts from a class:

AnnotationAnalyzer analyzer = new AnnotationAnalyzer();
List<FieldTextInfo> infos = analyzer.createFieldInfos(MyClass.class, Locale.US, Label.class);
for (final FieldTextInfo info : infos) {
	// Text of the label or the name of the field if the text is null

Create a list of TableColumnInfo that combines @Label, @ShortLabel and @TableColumn annotations.

List<TableColumnInfo> columns = TableColumnInfo.create(MyClass.class, Locale.US);
for (TableColumnInfo column : columns) {

This allows easy creation of a table model for example for JavaFX:

TableView<MyClass> tableView = new TableView<>();
List<TableColumnInfo> tableCols = TableColumnInfo.create(MyClass.class, Locale.getDefault());
for (TableColumnInfo column : tableCols) {
    TableColumn<MyClass, String> tc = new TableColumn<>();
    tc.setStyle("-fx-alignment: CENTER;");
    Label label = new Label(column.getShortText());
    label.setTooltip(new Tooltip(column.getTooltip()));
    tc.setCellValueFactory(new PropertyValueFactory<MyClass, String>(column.getField().getName()));

Description "vo"

Provides Value Objects (immutable objects) that represents an object whose equality isn't based on identity. That means instances of this type are equal when they have the same value, not necessarily being the same object. Additionally some helper classes (like validators) are placed in this package.


  • ValueObject - Tag interface for value objects.
  • ValueObjectConverter - Converts a value object into it's base type and back.
  • ValueObjectWithBaseType - Value object that may be expressed in a more general type with relaxed restrictions. Often basic Java types like String or numeric values (Long, Integer, ...) are used for this.
  • ValueOfCapable - Classes that can convert a string into a type (They have a valueOf(String) method).
  • AsStringCapable - Classes that provides a string representation (They have a asString() method).

Base classes that allow an easy implementation of concrete classes.

Predefined Value Objects



  • KeyValue - Container for a key (String) and a value (Object).


Snapshots can be found on the OSS Sonatype Snapshots Repository.

Add the following to your .m2/settings.xml to enable snapshots in your Maven build:

    <name>Sonatype OSS Snapshot Repository</name>