Package org.hibernate.models.spi
Interface MemberDetails
- All Superinterfaces:
AnnotationTarget
- All Known Subinterfaces:
FieldDetails,MethodDetails,MutableMemberDetails,RecordComponentDetails
- All Known Implementing Classes:
DynamicFieldDetails,JdkFieldDetails,JdkMethodDetails,JdkRecordComponentDetails
- API Note:
- This can be a virtual member, meaning there is no physical member in the declaring type (which itself might be virtual)
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.hibernate.models.spi.AnnotationTarget
AnnotationTarget.AnnotationUsageProcessor<T,A extends Annotation>, AnnotationTarget.Kind -
Method Summary
Modifier and TypeMethodDescriptiondefault <A extends Annotation>
AnnotationDescriptor<A> Safe cast method for cases when the target is an annotation.default ClassDetailsdefault MemberDetailsdefault TypeDetailsFor plural members, the "element type"; otherwise, the member's typedefault 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).The class which declares this memberdefault TypeDetailsGet the plural element type for this member.default TypeDetailsGet the map key type for this member.intAccess to the member modifier flags.getName()The name of the member.getType()The member type.default MemberDetails.VisibilityGet the member's visibilitybooleanisArray()default booleanisField()Whether the member is a field.default booleanisFinal()booleanCan this member be a persistent attributebooleanisPlural()For member's with an associated type, whether that type considered plural.default booleanisStatic()Whether the member is staticdefault booleanWhether the member is syntheticFor members potentially representing attributes based on naming patterns, determine the attribute name.default TypeDetailsresolveRelativeAssociatedType(TypeVariableScope container) Same asresolveRelativeType(TypeVariableScope), but for the associated type.default ClassBasedTypeDetailsresolveRelativeClassType(TypeVariableScope container) Determine the concrete class of the member relative to the givencontainertype.default TypeDetailsresolveRelativeType(TypeVariableScope container) Determine the type of the member relative to the givencontainertype.Access to the underlying Member.toJavaMember(Class<?> declaringClass, ClassLoading classLoading, ModelsContext modelContext) Methods inherited from interface org.hibernate.models.spi.AnnotationTarget
asFieldDetails, asMethodDetails, asRecordComponentDetails, forEachAnnotationUsage, forEachAnnotationUsage, forEachDirectAnnotationUsage, forEachRepeatedAnnotationUsages, forEachRepeatedAnnotationUsages, fromAnnotations, fromContainers, fromSelfAndContainers, getAnnotationUsage, getAnnotationUsage, getDirectAnnotationUsage, getDirectAnnotationUsage, getDirectAnnotationUsages, getKind, getMetaAnnotated, getNamedAnnotationUsage, getNamedAnnotationUsage, getNamedAnnotationUsage, getNamedAnnotationUsage, getRepeatedAnnotationUsages, getRepeatedAnnotationUsages, hasAnnotationUsage, hasDirectAnnotationUsage, locateAnnotationUsage, walkContainers, walkSelfAndContainers
-
Method Details
-
getName
String getName()The name of the member. This would be the name of the method or field.- Specified by:
getNamein interfaceAnnotationTarget
-
getType
TypeDetails getType()The member type. May benull- Returns:
- Returns one of:
- for a field, the field type
- for a getter method, the return type
- for a setter method, the argument type
- otherwise,
null
-
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 (
-
getAssociatedType
For plural members, the "element type"; otherwise, the member's type -
getElementType
Get the plural element type for this member. If the member does not have a type or the member is not plural, anullis returned. For arrays, lists and sets the element type is returned. For maps, the value type is returned. -
getMapKeyType
Get the map key type for this member. If the member does not have a type or the member is not a map, anullis returned. -
getDeclaringType
ClassDetails getDeclaringType()The class which declares this member -
isPlural
boolean isPlural()For member's with an associated type, whether that type considered plural.- Returns:
trueWhen the member has a type and that type is an array or a Map or Collection inheritor
-
isArray
boolean isArray() -
getModifiers
int getModifiers()Access to the member modifier flags.- See Also:
-
getVisibility
Get the member's visibility -
isStatic
default boolean isStatic()Whether the member is static -
isSynthetic
default boolean isSynthetic()Whether the member is synthetic -
isFinal
default boolean isFinal() -
isField
default boolean isField()Whether the member is a field.- Returns:
trueindicates the member is a field;falseindicates it is a method.
-
isPersistable
boolean isPersistable()Can this member be a persistent attribute -
resolveAttributeName
String resolveAttributeName()For members potentially representing attributes based on naming patterns, determine the attribute name. Returnnullif the name does not match the pattern for an attribute name. -
toJavaMember
Member toJavaMember()Access to the underlying Member. May returnnull. May throw an exception.- Returns:
- The underlying member, or
nullif there is no underlying member. - Throws:
RuntimeException- If there is expected to be a member, but it cannot be located.
-
toJavaMember
-
resolveRelativeType
Determine the type of the member relative to the givencontainertype. For example, given
Accessing theclass Thing<T extends Number>{ T id; }class SubThing extends Thing<Integer>{ ... }idmember relative toThingsimply returns the type variableT. However, asking theidmember for its type relative toSubThingwill reportInteger.- Throws:
IllegalStateException- If called on a member other than a field, getter, setter or record component.- API Note:
- It is only valid to call this on members which have a type, i.e. fields, getters, setters and record components.
-
resolveRelativeAssociatedType
Same asresolveRelativeType(TypeVariableScope), but for the associated type.- See Also:
-
resolveRelativeClassType
Determine the concrete class of the member relative to the givencontainertype. Similar to resolveRelativeType(TypeVariableScope), but fully resolving the result into the concrete class. -
asMemberDetails
Description copied from interface:AnnotationTarget- Specified by:
asMemberDetailsin interfaceAnnotationTarget
-
asAnnotationDescriptor
Description copied from interface:AnnotationTargetSafe cast method for cases when the target is an annotation.- Specified by:
asAnnotationDescriptorin interfaceAnnotationTarget
-
asClassDetails
Description copied from interface:AnnotationTarget- Specified by:
asClassDetailsin interfaceAnnotationTarget
-