Class CmsFormatterIndex
Formatters can now have multiple keys, which makes overriding them in more specific sitemap/master configurations more complex. Let X and Y be active sitemap/master configurations for the currently requested page, with Y being more specific than X. If X adds a formatter F1 with keys A, B, C and Y adds a different formatter F2 with an overlapping set of keys C, D, E, then as a result, formatter F1 should be disabled and formatter F2 should be used for the keys A, B, C, D, E (even though it does not have A and B as configured keys).
You use an instance of this class by adding/removing formatters in the order these operations are defined by the sitemap configuration and finally calling the getFormattersWithAdditionalKeys() method at the end, which augments the formatters it returns by adding the appropriate keys.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFormatter
(I_CmsFormatterBean formatter) Adds the given formatter.Gets the final map of active formatters, with their formatter keys replaced by the total set of keys under which they should be available.void
Removes the formatter with the given id.void
removeIf
(Predicate<I_CmsFormatterBean> condition) Removes all formatters matching the given predicate
-
Constructor Details
-
CmsFormatterIndex
public CmsFormatterIndex()
-
-
Method Details
-
addFormatter
Adds the given formatter.If there are any direct or indirect overlaps with the keys of already added formatters, these formatters will be removed and their keys mapped to the new formatter.
- Parameters:
formatter
- the formatter to add
-
getFormattersWithAdditionalKeys
Gets the final map of active formatters, with their formatter keys replaced by the total set of keys under which they should be available.- Returns:
- the map of formatters by id
-
remove
Removes the formatter with the given id.- Parameters:
id
- the formatter id
-
removeIf
Removes all formatters matching the given predicate- Parameters:
condition
- the condition to use for checking which formatters should be removed
-