Skip to content

Java imports

The Java samples in these docs leave the import lines out to stay short. They compile with single-type imports — one import io.mateu.uidl.annotations.Menu; per type — and your IDE adds those for you. They do not compile with wildcard imports of two Mateu packages at once:

import io.mateu.uidl.annotations.*;
import io.mateu.uidl.data.*; // ← `Menu`, `Button`, `Text`… now exist twice
public class Shell {
@Menu Products products; // error: reference to Menu is ambiguous
}

The reason is deliberate: an annotation and the data record it stands for share a name (@Button on a method vs a fluent Button you put in a component tree). If you prefer wildcards, import one package with a wildcard and the clashing types from the other one by name — a single-type import wins over a wildcard.

Simple nameWhereWhich one a sample means
Actionannotations, fluent@Action on a method → annotations; an Action in actions() → fluent
Appannotations, interfaces@App(...) on the shell class → annotations
Avatar, Badge, Breadcrumb, Breadcrumbs, BulletedList, Details, Icon, KPI, Notice, Status, Tab, Text, Tooltipannotations, dataon a field → annotations; built with new/.builder() in a component tree → data
Button, Menu, FormLayout, RestAction, Rule, Validationannotations, datasame rule: annotation vs record
Filterable, Searchableannotations, interfacesimplements Filterable<F> / Searchable on a listing → interfaces; @Searchable on a lookup field → annotations
Listingfluent, interfacesimplements Listing<Row> → interfaces; a fluent listing component → fluent
Pagedata, interfacesPage<T> returned by CrudStore.find → data
Stepdata, fluenta flow step returned by an action → fluent
Triggerannotations, fluent@Trigger on a class → annotations; a trigger in triggers() → fluent
UIannotations, fluent@UI("/route") → annotations

All packages above are under io.mateu.uidl.

Mateu typeClashes withTip
io.mateu.uidl.annotations.Listjava.util.Listimport java.util.List by name; the annotation is rarely needed
io.mateu.uidl.data.Map (the map component)java.util.Maprefer to one of them by its full name
io.mateu.uidl.data.Imagejava.awt.Imageonly matters if you also import java.awt.*