Package org.hibernate.models.spi
Interface ClassDetails
- All Superinterfaces:
AnnotationTarget,Storable<ClassDetails,,SerialClassDetails> TypeVariableScope
- All Known Subinterfaces:
ClassDetailsSupport,MutableClassDetails
- All Known Implementing Classes:
DynamicClassDetails,JdkClassDetails,MissingPackageInfoDetails,SimpleClassDetails
public interface ClassDetails
extends AnnotationTarget, TypeVariableScope, Storable<ClassDetails,SerialClassDetails>
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.hibernate.models.spi.AnnotationTarget
AnnotationTarget.AnnotationUsageProcessor<T,A extends Annotation>, AnnotationTarget.Kind -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClassDetailsDetails forClass.classstatic final ClassDetailsDetails forObject.classstatic final ClassDetailsDetails forvoid.classstatic final ClassDetailsDetails forVoid.class -
Method Summary
Modifier and TypeMethodDescriptiondefault <A extends Annotation>
AnnotationDescriptor<A> Safe cast method for cases when the target is an annotation.default ClassDetailsdefault FieldDetailsdefault MemberDetailsdefault MethodDetailsdefault RecordComponentDetailsSafe cast method for cases when the target is a record component.default ClassDetailsDetermine the raw class for the given type.default FieldDetailsfindField(Predicate<FieldDetails> check) Find a field by checkdefault FieldDetailsfindFieldByName(String name) Find a field by namedefault RecordComponentDetailsFind a record component by checkdefault RecordComponentDetailsFind a record component by namevoidforEachField(IndexedConsumer<FieldDetails> consumer) Visit each fielddefault voidforEachMember(Consumer<MemberDetails> consumer) voidforEachMethod(IndexedConsumer<MethodDetails> consumer) Visit each methoddefault voidforEachPersistableMember(Consumer<MemberDetails> consumer) voidVisit each methoddefault voidWalk our super-classes passing each to theconsumerdefault voidPass ourselves into theconsumerand then the same for each super classThe name of theClass, ornullfor dynamic models.default ClassDetailsgetContainer(ModelsContext modelsContext) Get the ClassDetails for the class which is the "container" for this target. For a member (org.hib.Thing#id), this will be the declaring type (org.hib.Thing).Get the fields for this classGeneric type information for this class.Details for the interfaces this class implements.default AnnotationTarget.KindgetKind()The kind of targetGet the methods for this classgetName()The name of the class.Get the record components for this classDetails for the class that is the super type for this class.Access to the type parameters associated with this class.booleanWhether the class should be considered abstract.booleanisEnum()Whether this class is an enumbooleanisImplementor(Class<?> checkType) Whether the described class is an implementor of the givencheckType.booleanWhether this class is an interfacebooleanisRecord()Where the class is a Java recordbooleanWhether the Class, if one, represented by this ClassDetails is already loaded on the ClassLoader used for loading.default booleanisSuperclass(ClassDetails classDetails) Returnstrueis the provided classDetails is a superclass of this class,falseotherwisedefault TypeDetailsresolveTypeVariable(TypeVariableDetails typeVariable) Resolve the type of the provided type variable relative to this scope.<X> Class<X> Load the corresponding Class using standard ClassLoading.<X> Class<X> toJavaClass(ClassLoading classLoading, ModelsContext modelContext) Load the corresponding Class using the specifiedClassLoading.Methods inherited from interface org.hibernate.models.spi.AnnotationTarget
forEachAnnotationUsage, forEachAnnotationUsage, forEachDirectAnnotationUsage, forEachRepeatedAnnotationUsages, forEachRepeatedAnnotationUsages, fromAnnotations, fromContainers, fromSelfAndContainers, getAnnotationUsage, getAnnotationUsage, getDirectAnnotationUsage, getDirectAnnotationUsage, getDirectAnnotationUsages, getMetaAnnotated, getNamedAnnotationUsage, getNamedAnnotationUsage, getNamedAnnotationUsage, getNamedAnnotationUsage, getRepeatedAnnotationUsages, getRepeatedAnnotationUsages, hasAnnotationUsage, hasDirectAnnotationUsage, locateAnnotationUsage, walkContainers, walkSelfAndContainersMethods inherited from interface org.hibernate.models.serial.spi.Storable
toStorableForm
-
Field Details
-
OBJECT_CLASS_DETAILS
Details forObject.class -
CLASS_CLASS_DETAILS
Details forClass.class -
VOID_CLASS_DETAILS
Details forvoid.class -
VOID_OBJECT_CLASS_DETAILS
Details forVoid.class
-
-
Method Details
-
getKind
Description copied from interface:AnnotationTargetThe kind of target- Specified by:
getKindin interfaceAnnotationTarget
-
getName
String getName()The name of the class. Generally this is the same as the class name. But in the case of Hibernate'sentity-namefeature, this would be theentity-name- Specified by:
getNamein interfaceAnnotationTarget
-
getClassName
String getClassName()The name of theClass, ornullfor dynamic models.- API Note:
- Will be
nullfor dynamic models
-
getContainer
Description copied from interface:AnnotationTargetGet the ClassDetails for the class which is the "container" for this target.- For a member (
org.hib.Thing#id), this will be the declaring type (org.hib.Thing). - For a class (
org.hib.Thing), this will be the ClassDetails for its package (org.hib.package-info) - For a package (
org.hib.package-info), this will be the ClassDetails for the containing package (org.package-info)
- Specified by:
getContainerin interfaceAnnotationTarget
- For a member (
-
isResolved
boolean isResolved()Whether the Class, if one, represented by this ClassDetails is already loaded on the ClassLoader used for loading.- Returns:
truewhen there is a physical backing class, and it is loaded;falseotherwise.
-
isAbstract
boolean isAbstract()Whether the class should be considered abstract. -
isInterface
boolean isInterface()Whether this class is an interface -
isEnum
boolean isEnum()Whether this class is an enum -
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()Generic type information for this class. -
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
Walk our super-classes passing each to theconsumer -
forSelfAndEachSuper
Pass ourselves into theconsumerand then the same for each super class -
isSuperclass
Returnstrueis the provided classDetails is a superclass of this class,falseotherwise -
resolveTypeVariable
Description copied from interface:TypeVariableScopeResolve the type of the provided type variable relative to this scope. For example, givenclass
A call to this method on theThing<I extends Number>{ I id; }Thingscope with the type variable representingIwill return theI extends Numbertype variable definition itself. If this scope defines a corresponding type argument, the concrete type is returned. For example, givenclass
This method will yield theStuff extends Thing<Integer>{ }Integertype details.- Specified by:
resolveTypeVariablein interfaceTypeVariableScope- Parameters:
typeVariable- The type variable to resolve- Returns:
- The type variable's resolved type, or
nullif none could be found
-
determineRawClass
Description copied from interface:TypeVariableScopeDetermine the raw class for the given type. Never returnsnull, opting to return Object instead if the raw class is not known- Specified by:
determineRawClassin interfaceTypeVariableScope- Returns:
- The raw class details, or Object if "not known".
-
isImplementor
Whether the described class is an implementor of the givencheckType. -
getFields
List<FieldDetails> getFields()Get the fields for this class -
forEachField
Visit each field -
findField
Find a field by check -
findFieldByName
Find a field by name -
getMethods
List<MethodDetails> getMethods()Get the methods for this class -
forEachMethod
Visit each method -
getRecordComponents
List<RecordComponentDetails> getRecordComponents()Get the record components for this class -
findRecordComponent
Find a record component by check -
findRecordComponentByName
Find a record component by name -
forEachRecordComponent
Visit each method -
forEachMember
-
forEachPersistableMember
-
toJavaClass
Load the corresponding Class using standard ClassLoading.- Throws:
DynamicClassException- If this ClassDetails does not correspond to a Java class (generally meaning getClassName() returnsnull).- See Also:
- API Note:
- Know what you are doing before calling this method
-
toJavaClass
Load the corresponding Class using the specifiedClassLoading.- Parameters:
classLoading- Where to load the class from/intomodelContext- The model context- Throws:
DynamicClassException- If this ClassDetails does not correspond to a Java class (generally meaning getClassName() returnsnull).
-
asClassDetails
Description copied from interface:AnnotationTarget- Specified by:
asClassDetailsin interfaceAnnotationTarget
-
asAnnotationDescriptor
Description copied from interface:AnnotationTargetSafe cast method for cases when the target is an annotation.- Specified by:
asAnnotationDescriptorin interfaceAnnotationTarget
-
asMemberDetails
Description copied from interface:AnnotationTarget- Specified by:
asMemberDetailsin interfaceAnnotationTarget
-
asFieldDetails
Description copied from interface:AnnotationTarget- Specified by:
asFieldDetailsin interfaceAnnotationTarget
-
asMethodDetails
Description copied from interface:AnnotationTarget- Specified by:
asMethodDetailsin interfaceAnnotationTarget
-
asRecordComponentDetails
Description copied from interface:AnnotationTargetSafe cast method for cases when the target is a record component.- Specified by:
asRecordComponentDetailsin interfaceAnnotationTarget
-