You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: expand DumAemTargetAttrValueMap API reference
Replace the previous brief 'addWithValue — Polymorphic Dispatch' note with a full API reference for DumAemTargetAttrValueMap in docs-dumont/extending-aem.md. The new content documents the override parameter behavior, typed addWithSingleValue overloads, collection adders, polymorphic addWithValue dispatch, merge semantics, static singleItem factories, usage examples, and a quick-reference table to make the map's behavior and APIs clear to consumers.
Copy file name to clipboardExpand all lines: docs-dumont/extending-aem.md
+131-4Lines changed: 131 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -399,16 +399,143 @@ public class MyPortalModelJson extends DumAemExtModelJsonBase<MyPortalModel> {
399
399
}
400
400
```
401
401
402
-
### addWithValue — Polymorphic Dispatch
402
+
### DumAemTargetAttrValueMap — API Reference
403
403
404
-
`DumAemTargetAttrValueMap` includes `addWithValue(String name, Object value, boolean override)` which automatically dispatches to the correct typed method. This is used internally by the fluent API and can also be used directly:
404
+
`DumAemTargetAttrValueMap` is the core data structure for collecting extracted attributes. It extends `HashMap<String, TurMultiValue>` and provides typed methods for adding values safely (null values are silently ignored).
405
+
406
+
#### The `override` parameter
407
+
408
+
Every method accepts a `boolean override` parameter that controls what happens when the attribute already exists in the map:
409
+
410
+
|`override`| Attribute exists? | Behavior |
411
+
|---|---|---|
412
+
|`true`| Yes |**Replaces** the existing value |
413
+
|`true`| No | Adds the value |
414
+
|`false`| Yes |**Appends** to the existing multi-value (merge) |
415
+
|`false`| No | Adds the value |
416
+
417
+
#### Instance Methods — Adding Single Values
418
+
419
+
Use `addWithSingleValue` to add a single typed value to the map:
420
+
421
+
```java
422
+
// String
423
+
attrValues.addWithSingleValue("title", "My Page Title", true);
|`addWithDateCollectionValue(name, list, override)`|`List<Date>`| Adds multiple date values |
482
+
483
+
#### Instance Methods — Polymorphic Dispatch
484
+
485
+
`addWithValue` accepts any `Object` and automatically dispatches to the correct typed method based on runtime type. This is used internally by the fluent API and can also be used directly:
405
486
406
487
```java
407
-
// Automatically calls the right overload based on runtime type
488
+
// Automatically calls the right addWithSingleValue overload
Supports: `String`, `Date`, `Boolean`, `Integer`, `Long`, `Double`, `Float`, and `TurMultiValue`. Any other type is converted to `String` via `toString()`.
493
+
494
+
#### Instance Methods — Merging Maps
495
+
496
+
```java
497
+
// Merge another map into this one (respects override flags)
498
+
attrValues.merge(otherAttrValues);
499
+
```
500
+
501
+
The `merge` method combines two attribute maps. For each key in the source map:
502
+
- If `override` is `true` on the source value → replaces the existing value
503
+
- If `override` is `false` → appends to the existing multi-value
504
+
505
+
#### Static Factory Methods
506
+
507
+
Create a pre-populated map with a single attribute in one call:
0 commit comments