docs: update specifications#5
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec Update Rationale
Changes applied to
SPECIFICATIONS.mdbased onfirst-iterationimplementation experience.4.1 —
getColumnConfig→getColumn; return typeEasyColumn<T,V>The original name
getColumnConfigimplies the method returns a configuration bag — a passive data holder separate from the column itself. In practice the returned object is the column: it wraps the underlyingGrid.Column<T>, drives its renderer, and is the primary handle for all subsequent column work. Calling it a "config" understates its role and misleads callers about what they are holding.getColumnis also the natural name by analogy withGrid.getColumnByKey, which callers already use when working with the plain Vaadin API. The rename makes the relationship obvious without any documentation overhead.Renaming the return type from the implied
EasyColumnConfigtoEasyColumn<T,V>follows the same logic: the object models the column, not its configuration.4.2 — Fluent method naming:
with*→set*with*is the established Java convention for immutable builders and records: each call returns a new object with one field changed, leaving the receiver unchanged.EasyColumnis not immutable — every method mutates the column in place and returnsthisfor chaining. Usingwith*in this context would create a false expectation of copy-on-write semantics and surprise callers who assume the original reference is unmodified.set*is the standard JavaBean convention for mutable setters, which is exactly what these methods are. It is also consistent withGrid.Columnitself, so callers moving between the Vaadin API and the EasyGrid API encounter no naming discontinuity.4.5 — Boolean default labels:
"Yes"/"No"→"true"/"false""Yes"and"No"are natural-language words. They are English-specific and carry no formal relationship to the underlyingBooleantype. A default that reads "Yes" will look wrong in any non-English application without explicit overrides, and it will surprise developers who expect the rendered value to reflect the data value."true"and"false"are the canonical string representation ofBooleanin Java (Boolean.toString()). They are locale-neutral, unambiguous, and predictable — the default behavior matches what a plaintoString()call would produce. Callers who want "Yes"/"No" (or any other labels) can configure them explicitly viasetBooleanLabels("Yes", "No"), a call whose intent is self-documenting.5.3 —
EasyGrid(Grid<T>, Class<T>, boolean)constructorThe two constructors defined in the original spec handle the two most common construction patterns: auto-discover all properties, or specify a fixed ordered list. A third pattern is common in practice: the caller wants EasyGrid's type resolution and configuration infrastructure but needs to decide which columns to add at runtime — for example, based on user roles, feature flags, or a dynamic column set loaded from configuration.
Neither existing constructor fits: the auto-discover constructor adds too many columns, and the varargs constructor requires a compile-time fixed list. The
booleanconstructor fills this gap cleanly. Passingfalsesuppresses all automatic column creation; the caller then callsaddColumn(...)explicitly, with full access to the configuration tree on each returnedEasyColumn. This also avoids the antipattern of creating a grid with all columns and then hiding the unwanted ones.5.4 —
EasyColumndelegatesGrid.Columnsetters directlyThe original spec divided column configuration across two objects: type-specific formatting on
EasyColumn(viawith*methods), and everything else onGrid.Column(viagetColumn()). This forced callers to break the fluent chain every time they crossed from EasyGrid-managed config to standard column config:The two-object model also impairs discoverability: IDEs show only the EasyGrid-specific methods on
EasyColumn, so callers must know to callgetColumn()to see the rest. This creates a hidden API surface.Delegating the full
Grid.Columnsetter API directly onEasyColumneliminates the break and makes the entire column API visible on a single object:getColumn()is retained as an escape hatch for the rare cases not covered by the delegation layer.5.5 —
addColumn(Class<V>, ValueProvider<T, ? extends V>)overloadBean property introspection covers the common case, but real grids regularly need columns that do not correspond to a named property: a formatted combination of fields, a computed value, a summary derived from a collection, or a value sourced from an external object. Without a typed
addColumnoverload, the only option for such columns is to fall back to the rawGridAPI, which bypasses EasyGrid's configuration tree entirely — type-level formatters and default renderers registered viaGlobalEasyGridConfigurationwould not apply.The
Class<V>parameter preserves the connection to the configuration tree. ABigDecimalcomputed column picks up anyBigDecimalformatter registered globally or at the session level, exactly as a property-backedBigDecimalcolumn would. The caller sets header, key, and any other column-specific config on the returnedEasyColumnin the normal way.