#734: ILabelValueBean.java

projectforge-business/src/main/java/org/projectforge/framework/utils/ILabelValueBean.java Lines: 35 · Author: Kai Reinhard · Type: Java generic interface — org.projectforge.framework.utils 35 lines · 6 code · 26 comments · 3 blank

Purpose

The Label/Value pattern — a core UI abstraction used everywhere in ProjectForge to populate dropdown menus, selection lists, and autocomplete widgets. Every combobox, every multi-select, every radio button group in Wicket and React ultimately builds its options from objects implementing this interface.

The interface has just two methods: getLabel() (what the user sees — the display text, typically localized) and getValue() (what the system stores — typically a database ID or enum constant). The generic types <L, V> allow the label and value to be different types — e.g. LabelValueBean<String, Long> for a user picker (label = "John Doe", value = 42L).

The "I" prefix is ProjectForge's Hungarian-style naming convention for interfaces (I = Interface), common in older Java codebases. The implementation is LabelValueBean.

Why two type parameters?

Most label/value beans in the wild use String, String — the value is a stringified ID. ProjectForge chose separate generic types so the value maintains its native type. This matters because:

Usage patterns in ProjectForge

This interface is to ProjectForge what Map.Entry is to Java collections — a simple two-element tuple that appears everywhere in the UI layer.