Package org.apache.juneau.console
Class CardTypeRegistry
java.lang.Object
org.apache.juneau.console.CardTypeRegistry
The open set of server-side card type handlers.
standard() holds the built-ins (html),
every CardTypeHandler found through ServiceLoader (this is how
console-ui-freemarker contributes datatables and terminal), and falls back to the
generic passthrough for unknown types. standard() is immutable; a host that adds its own types
works on a copy(), so one host's types never leak into another's.
Example:
CardTypeRegistry
- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds aCardTypeRegistryon top of an existing one, or from scratch. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncopy()booleanisRegistered(String type) static CardTypeRegistrystandard()toCard(CardSource source) The single server path for both<@card>and C3'sPageSpec: validates the body (E-23), dispatches tohandler(String), and merges the fragment flat onto the card's base keys.types()
-
Field Details
-
RESERVED
Reserved type names:html(built in),datatables,terminal-view,terminal,chartandjob-log(console-ui-freemarker).
-
-
Method Details
-
standard
- Returns:
- The standard registry:
htmlplus every ServiceLoader-discovered handler.
-
copy
- Returns:
- A
CardTypeRegistry.Builderpre-seeded with this registry's handlers, to add more on top.
-
handler
- Parameters:
type- The card type name.- Returns:
- The registered handler for
type, or the generic passthrough when none is registered.
-
isRegistered
- Parameters:
type- The card type name.- Returns:
true if a handler is registered fortype(not counting the generic fallback).
-
types
- Returns:
- Every registered type name.
-
toCard
The single server path for both<@card>and C3'sPageSpec: validates the body (E-23), dispatches tohandler(String), and merges the fragment flat onto the card's base keys. A JSON body'svisibleWhen,subscribesandpublishesare promoted onto the card itself (the handler never seessubscribes/publishes).- Parameters:
source- The authored card.- Returns:
- The card object: base keys plus the handler's fragment, flat.
- Throws:
IllegalArgumentException- E-23 if the body sets a reserved key; ifsrcis not a same-origin path (seeSafePathTemplate.isSameOriginPath(String); a{token}placeholder is allowed); or from the handler itself.
-