TypeIdPlatformSpecific

zio.blocks.typeid.TypeIdPlatformSpecific

Platform-specific methods for TypeId.

On JVM, provides reflection-based capabilities. On JS, returns None for reflection operations.

Attributes

Source
TypeIdPlatformSpecific.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait TypeId[A]
Self type
TypeId[_ <: AnyKind]

Members list

Value members

Abstract methods

def clazz: Option[Class[_]]

Returns the Class associated with this TypeId, if available.

Returns the Class associated with this TypeId, if available.

On the JVM, for nominal types, this returns the Class object corresponding to this type's fullName. On JS, always returns None.

Note: This only works for nominal types (not aliases or opaque types). For generic types, returns the erased class (e.g., List[Int] returns classOf[List[_]]).

Attributes

Source
TypeIdPlatformSpecific.scala
def construct(args: Chunk[AnyRef]): Either[String, Any]

Constructs an instance of the type represented by this TypeId using the provided arguments.

Constructs an instance of the type represented by this TypeId using the provided arguments.

On the JVM, this uses reflection to invoke the primary constructor. For known types (collections, java.time, etc.), optimized construction is used.

On JS, always returns Left with an error message.

Value parameters

args

the constructor arguments

Attributes

Returns

Right with the constructed instance, or Left with an error message

Source
TypeIdPlatformSpecific.scala