Interface ClassDetails

All Superinterfaces:
AnnotationTarget, TypeVariableScope
All Known Subinterfaces:
ClassDetailsSupport, MutableClassDetails
All Known Implementing Classes:
DynamicClassDetails, JandexClassDetails, JdkClassDetails, SimpleClassDetails

public interface ClassDetails extends AnnotationTarget, TypeVariableScope
Abstraction for what Hibernate understands about a "class", generally before it has access to the actual Class reference, if there is a Class at all (dynamic models).
See Also:
  • Field Details

    • OBJECT_CLASS_DETAILS

      static final ClassDetails OBJECT_CLASS_DETAILS
      Details for Object.class
    • CLASS_CLASS_DETAILS

      static final ClassDetails CLASS_CLASS_DETAILS
      Details for Class.class
    • VOID_CLASS_DETAILS

      static final ClassDetails VOID_CLASS_DETAILS
      Details for void.class
    • VOID_OBJECT_CLASS_DETAILS

      static final ClassDetails VOID_OBJECT_CLASS_DETAILS
      Details for Void.class
  • Method Details

    • getKind

      default AnnotationTarget.Kind getKind()
      Description copied from interface: AnnotationTarget
      The kind of target
      Specified by:
      getKind in interface AnnotationTarget
    • getName

      String getName()
      The name of the class.

      Generally this is the same as the class name. But in the case of Hibernate's entity-name feature, this would be the entity-name

      Specified by:
      getName in interface AnnotationTarget
    • getClassName

      String getClassName()
      The name of the Class, or null for dynamic models.
      API Note:
      Will be null for dynamic models
    • isResolved

      boolean isResolved()
      Whether the Class, if one, represented by this ClassDetails is already loaded on the ClassLoader used for loading.
      Returns:
      true when there is a physical backing class, and it is loaded; false otherwise.
    • isAbstract

      boolean isAbstract()
      Whether the class should be considered abstract.
    • isRecord

      boolean isRecord()
      Where the class is a Java record
    • getSuperClass

      ClassDetails getSuperClass()
      Details for the class that is the super type for this class.
    • getGenericSuperType

      TypeDetails getGenericSuperType()
    • getImplementedInterfaces

      List<TypeDetails> getImplementedInterfaces()
      Details for the interfaces this class implements.
    • getTypeParameters

      List<TypeVariableDetails> getTypeParameters()
      Access to the type parameters associated with this class.
    • forEachSuper

      default void forEachSuper(ClassDetails.ClassDetailsConsumer consumer)
      Walk our super-classes passing each to the consumer
    • forSelfAndEachSuper

      default void forSelfAndEachSuper(ClassDetails.ClassDetailsConsumer consumer)
      Pass ourselves into the consumer and then the same for each super class
    • isSuperclass

      default boolean isSuperclass(ClassDetails classDetails)
      Returns true is the provided classDetails is a superclass of this class, false otherwise
    • resolveTypeVariable

      default TypeDetails resolveTypeVariable(TypeVariableDetails typeVariable)
      Description copied from interface: TypeVariableScope
      Resolve the type of the provided type variable relative to this scope.

      For example, given

       class Thing<I extends Number> {
           I id;
       }
       
      A call to this method on the Thing scope with the type variable representing I will return the I extends Number type variable definition itself.

      If this scope defines a corresponding type argument, the concrete type is returned. For example, given

       class Stuff extends Thing<Integer> {
       }
       
      This method will yield the Integer type details.
      Specified by:
      resolveTypeVariable in interface TypeVariableScope
      Parameters:
      typeVariable - The type variable to resolve
      Returns:
      The type variable's resolved type, or null if none could be found
    • determineRawClass

      default ClassDetails determineRawClass()
      Description copied from interface: TypeVariableScope
      Determine the raw class for the given type. Never returns null, opting to return Object instead if the raw class is not known
      Specified by:
      determineRawClass in interface TypeVariableScope
      Returns:
      The raw class details, or Object if "not known".
    • isImplementor

      boolean isImplementor(Class<?> checkType)
      Whether the described class is an implementor of the given checkType.
    • getFields

      List<FieldDetails> getFields()
      Get the fields for this class
    • forEachField

      void forEachField(IndexedConsumer<FieldDetails> consumer)
      Visit each field
    • findField

      default FieldDetails findField(Predicate<FieldDetails> check)
      Find a field by check
    • findFieldByName

      default FieldDetails findFieldByName(String name)
      Find a field by name
    • getMethods

      List<MethodDetails> getMethods()
      Get the methods for this class
    • forEachMethod

      void forEachMethod(IndexedConsumer<MethodDetails> consumer)
      Visit each method
    • getRecordComponents

      List<RecordComponentDetails> getRecordComponents()
      Get the record components for this class
    • findRecordComponent

      default RecordComponentDetails findRecordComponent(Predicate<RecordComponentDetails> check)
      Find a record component by check
    • findRecordComponentByName

      default RecordComponentDetails findRecordComponentByName(String name)
      Find a record component by name
    • toJavaClass

      <X> Class<X> toJavaClass()
      Know what you are doing before calling this method