Module storm
Package st.orm.spi

Interface ORMReflection

All Known Implementing Classes:
DefaultORMReflectionImpl

public interface ORMReflection
Provides pluggable reflection support for the ORM to support different JVM languages, such as Java and Kotlin.
  • Method Details

    • findCanonicalConstructor

      Optional<Constructor<?>> findCanonicalConstructor(@Nonnull Class<? extends Record> type)
      Returns the canonical constructor for the specified record type.

      The canonical constructor is the base constructor that is used to create new instances of the record type.

      Parameters:
      type - the record type.
      Returns:
      the record components of the specified record type.
    • findPKType

      Optional<Class<?>> findPKType(@Nonnull Class<? extends Record> type)
      Returns the primary key type for the specified record type, if available.
      Parameters:
      type - the record type.
      Returns:
      the primary key type for the specified record type, or an empty optional if no primary key type is available.
    • isAnnotationPresent

      boolean isAnnotationPresent(@Nonnull RecordComponent component, @Nonnull Class<? extends Annotation> annotationType)
      Checks if the specified record component has the specified annotation.
      Parameters:
      component - the record component to check for the specified annotation.
      annotationType - the annotation type to check for.
      Returns:
      true if the specified record component has the specified annotation, false otherwise.
    • isAnnotationPresent

      boolean isAnnotationPresent(@Nonnull Class<?> type, @Nonnull Class<? extends Annotation> annotationType)
      Checks if the specified type has the specified annotation.
      Parameters:
      type - the type to check for the specified annotation.
      annotationType - the annotation type to check for.
      Returns:
      true if the specified type has the specified annotation, false otherwise.
    • getAnnotation

      <A extends Annotation> A getAnnotation(@Nonnull RecordComponent component, @Nonnull Class<A> annotationType)
      Returns the annotation of the specified type for the specified record component, if present.
      Type Parameters:
      A - the annotation type.
      Parameters:
      component - the record component to get the annotation from.
      annotationType - the annotation type to get.
      Returns:
      the annotation of the specified type for the specified record component, or null if not present.
    • getAnnotations

      <A extends Annotation> A[] getAnnotations(@Nonnull RecordComponent component, @Nonnull Class<A> annotationType)
      Returns the annotations of the specified type for the specified record component, supporting repeatable annotations.
      Type Parameters:
      A - the annotation type.
      Parameters:
      component - the record component to get the annotation from.
      annotationType - the annotation type to get.
      Returns:
      the annotation of the specified type for the specified record component, or null if not present.
    • getAnnotation

      <A extends Annotation> A getAnnotation(@Nonnull Class<?> type, @Nonnull Class<A> annotationType)
      Returns the annotation of the specified type for the specified type, if present.
      Type Parameters:
      A - the annotation type.
      Parameters:
      type - the type to get the annotation from.
      annotationType - the annotation type to get.
      Returns:
      the annotation of the specified type for the specified type, or null if not present.
    • isSupportedType

      boolean isSupportedType(@Nonnull Object o)
    • getType

      Class<?> getType(@Nonnull Object o)
    • getRecordType

      Class<? extends Record> getRecordType(@Nonnull Object o)
    • isDefaultValue

      boolean isDefaultValue(@Nullable Object o)
    • isNonnull

      boolean isNonnull(@Nonnull RecordComponent component)
      Returns true if the specified component has a non-null annotation, false otherwise.
      Parameters:
      component - the component to check for a non-null annotation.
      Returns:
      true if the specified component has a non-null annotation, false otherwise.
    • getPermittedSubclasses

      List<Class<?>> getPermittedSubclasses(@Nonnull Class<?> sealedClass)
      Returns the permitted subclasses of the specified sealed class.
      Parameters:
      sealedClass - the sealed class to get the permitted subclasses for.
      Returns:
      a list of permitted subclasses of the specified sealed class.
    • invokeComponent

      Object invokeComponent(@Nonnull RecordComponent component, @Nonnull Object record) throws Throwable
      Throws:
      Throwable
    • isDefaultMethod

      boolean isDefaultMethod(@Nonnull Method method)
    • execute

      Object execute(@Nonnull Object proxy, @Nonnull Method method, Object... args) throws Throwable
      Throws:
      Throwable