Gets the typed definition (or flat typed definition) "typeName" of a Courier union member's companion object.
Gets the typed definition (or flat typed definition) "typeName" of a Courier union member's companion object.
Example:
TypedDefinitions.typeName(ExampleUnion.AlphaMember)
See typeName(ScalaUnionTemplate)
for more details.
Gets the typed definition (or flat typed definition) "typeName" of a Courier union member instance.
Gets the typed definition (or flat typed definition) "typeName" of a Courier union member instance.
The provided type must be a properly structured typed definition (or flat typed definition). Namely:
- The union must be declared within a declaration of a typeref - The typeref must have a 'typedDefinition' or 'flatTypedDefinition' schema property - The schema property must contain a complete mapping of member keys (fully qualified Courier type name) to 'typeName' for all members of the union
If any of these conditions are not met, a IllegalArgumentException is thrown.
For example, given the schema:
namespace org.example @@typedDefinition = { "org.example.Alpha": "alpha", "org.example.Beta": "beta" } typeref ExampleUnion = union[ record Alpha {} record Beta {} ]
The Scala expression:
val member = ExampleUnion.AlphaMember(Alpha())
TypedDefinitions.typeName(member)
returns "alpha"
Convenience methods for working with Typed Definitions.