Module storm
Package st.orm.spi

Class DefaultORMReflectionImpl

java.lang.Object
st.orm.spi.DefaultORMReflectionImpl
All Implemented Interfaces:
ORMReflection

public final class DefaultORMReflectionImpl extends Object implements ORMReflection
  • Constructor Details

    • DefaultORMReflectionImpl

      public DefaultORMReflectionImpl()
  • Method Details

    • findCanonicalConstructor

      public Optional<Constructor<?>> findCanonicalConstructor(@Nonnull Class<? extends Record> type)
      Description copied from interface: ORMReflection
      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.

      Specified by:
      findCanonicalConstructor in interface ORMReflection
      Parameters:
      type - the record type.
      Returns:
      the record components of the specified record type.
    • findPKType

      public Optional<Class<?>> findPKType(@Nonnull Class<? extends Record> recordType)
      Description copied from interface: ORMReflection
      Returns the primary key type for the specified record type, if available.
      Specified by:
      findPKType in interface ORMReflection
      Parameters:
      recordType - 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

      public boolean isAnnotationPresent(@Nonnull RecordComponent component, @Nonnull Class<? extends Annotation> annotationType)
      Description copied from interface: ORMReflection
      Checks if the specified record component has the specified annotation.
      Specified by:
      isAnnotationPresent in interface ORMReflection
      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

      public boolean isAnnotationPresent(@Nonnull Class<?> type, @Nonnull Class<? extends Annotation> annotationType)
      Description copied from interface: ORMReflection
      Checks if the specified type has the specified annotation.
      Specified by:
      isAnnotationPresent in interface ORMReflection
      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

      public <A extends Annotation> A getAnnotation(@Nonnull RecordComponent component, @Nonnull Class<A> annotationType)
      Description copied from interface: ORMReflection
      Returns the annotation of the specified type for the specified record component, if present.
      Specified by:
      getAnnotation in interface ORMReflection
      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

      public <A extends Annotation> A[] getAnnotations(@Nonnull RecordComponent component, @Nonnull Class<A> annotationType)
      Description copied from interface: ORMReflection
      Returns the annotations of the specified type for the specified record component, supporting repeatable annotations.
      Specified by:
      getAnnotations in interface ORMReflection
      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

      public <A extends Annotation> A getAnnotation(@Nonnull Class<?> type, @Nonnull Class<A> annotationType)
      Description copied from interface: ORMReflection
      Returns the annotation of the specified type for the specified type, if present.
      Specified by:
      getAnnotation in interface ORMReflection
      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.
    • getType

      public Class<?> getType(@Nonnull Object o)
      Specified by:
      getType in interface ORMReflection
    • getRecordType

      public Class<? extends Record> getRecordType(@Nonnull Object clazz)
      Specified by:
      getRecordType in interface ORMReflection
    • isDefaultValue

      public boolean isDefaultValue(@Nullable Object o)
      Specified by:
      isDefaultValue in interface ORMReflection
    • isSupportedType

      public boolean isSupportedType(@Nonnull Object clazz)
      Specified by:
      isSupportedType in interface ORMReflection
    • isNonnull

      public boolean isNonnull(@Nonnull RecordComponent component)
      Description copied from interface: ORMReflection
      Returns true if the specified component has a non-null annotation, false otherwise.
      Specified by:
      isNonnull in interface ORMReflection
      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

      public List<Class<?>> getPermittedSubclasses(@Nonnull Class<?> sealedClass)
      Description copied from interface: ORMReflection
      Returns the permitted subclasses of the specified sealed class.
      Specified by:
      getPermittedSubclasses in interface ORMReflection
      Parameters:
      sealedClass - the sealed class to get the permitted subclasses for.
      Returns:
      a list of permitted subclasses of the specified sealed class.
    • invokeComponent

      public Object invokeComponent(@Nonnull RecordComponent component, @Nonnull Object record) throws Throwable
      Specified by:
      invokeComponent in interface ORMReflection
      Throws:
      Throwable
    • isDefaultMethod

      public boolean isDefaultMethod(@Nonnull Method method)
      Specified by:
      isDefaultMethod in interface ORMReflection
    • execute

      public Object execute(@Nonnull Object proxy, @Nonnull Method method, Object... args) throws Throwable
      Specified by:
      execute in interface ORMReflection
      Throws:
      Throwable