Skip to content
Anjunar/ DOCS

API

The macros that describe types, the descriptors they produce, and the runtime types that store them.

Macros

ReflectMacros and PropertySupport

All inline; the work happens at compile time.

ReflectMacros.reflect[T]: ClassDescriptor
The class, without accessors.
ReflectMacros.reflectWithAccessors[T]: ClassDescriptor
The class with an accessor per property.
ReflectMacros.reflectType[T]: TypeDescriptor
Any type, parameterized ones included.
ReflectMacros.makeAccessor[E, V](_.p): PropertyAccessor[E, V]
A typed getter; read-only in 1.1.4.
ReflectMacros.createInstance[T](args*): T
Calls a case class's primary constructor.
PropertySupport.makeProperty[T, V](_.p): PropertyWithAccessor[T, V]
Descriptor and accessor of one property.
PropertySupport.extractPropertiesWithAccessors[T]
All properties with accessors, inherited ones included.
Descriptors

What the macros produce

Plain case classes you can keep, compare and serialize.

ClassDescriptor
typeName, simpleName, properties, constructors, baseTypes, typeParameters, annotations, isAbstract, isFinal, isCaseClass.
PropertyDescriptor
name, propertyType, annotations, isReadable, isWriteable, visibility, accessor.
ConstructorDescriptor · ParameterDescriptor
Parameters with names, types and annotations; isPrimary.
Annotation(annotationClassName, parameters)
An annotation and its arguments by name.
Runtime

Where descriptors live

Global or scoped, with the same lookups.

ReflectRegistry
register, registerByTypeName, loadClass, loadClassBySimpleName, createInstance, getPropertyAccessor, isAssignableFrom, getSubTypes, clear.
ReflectClassLoader
create, createWithParent, register, loadClass, createInstanceAs, isAssignableFrom, getSubTypes, clearLocal. Looks up local, parent, then global.
ReflectClassLoaderWithResources
A class loader with addResource, getResource and getResources.