ObjectHelper.javaPolymorphic "isEmpty" check that handles both strings and numbers. 52 lines with one method — isEmpty(Object... values). Takes varargs of any type, returns true if ALL values are effectively empty. The logic per value:
null → considered empty (continues checking next value)String → empty if trim().length() == 0. A whitespace-only string like " " is emptyBigDecimal → empty if compareTo(ZERO) == 0. BigDecimal.ZERO and new BigDecimal("0.00") are both considered empty (they compare equal)false immediately. This short-circuits the loopUsed in form validation and data processing to check if a form field has meaningful content. Example: ObjectHelper.isEmpty(user.getFirstName(), user.getLastName()) — returns false if either name has content.
The method returns true (empty) when a non-String, non-BigDecimal object is present — this is counterintuitive for booleans, dates, or any type with a meaningful "empty" representation. A Boolean.FALSE value would cause isEmpty(falseObj) to return false (the non-null branch), which semantically means "not empty" even though false is often considered an "empty" boolean. The method is specialized for String and BigDecimal because those are the two main form field types in ProjectForge — text fields and currency fields. A more general approach would have used a Map<Class, Predicate> for extensible type-specific empty checks.