From 698a873ae11e151e6de4629ce983da9d6693d8b9 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 27 Aug 2024 10:56:50 -0500 Subject: [PATCH] Javadoc --- .../spi/JandexBuildingContextProvider.java | 3 +- .../models/internal/BaseLineJavaTypes.java | 3 +- .../hibernate/models/spi/AnnotationUsage.java | 63 ------------------- .../models/spi/ArrayTypeDetails.java | 2 - .../models/spi/ClassTypeDetails.java | 1 - .../models/spi/ParameterizedTypeDetails.java | 1 - .../models/spi/PrimitiveTypeDetails.java | 1 - .../spi/SourceModelBuildingContext.java | 2 - .../models/spi/TypeDetailsSwitch.java | 32 ++++++++++ .../models/spi/TypeVariableDetails.java | 1 - .../spi/TypeVariableReferenceDetails.java | 2 - .../models/spi/ValueTypeDescriptor.java | 2 +- .../models/spi/WildcardTypeDetails.java | 1 - 13 files changed, 36 insertions(+), 78 deletions(-) delete mode 100644 hibernate-models/src/main/java/org/hibernate/models/spi/AnnotationUsage.java diff --git a/hibernate-models-jandex/src/main/java/org/hibernate/models/jandex/spi/JandexBuildingContextProvider.java b/hibernate-models-jandex/src/main/java/org/hibernate/models/jandex/spi/JandexBuildingContextProvider.java index bc0e6bd..e199d56 100644 --- a/hibernate-models-jandex/src/main/java/org/hibernate/models/jandex/spi/JandexBuildingContextProvider.java +++ b/hibernate-models-jandex/src/main/java/org/hibernate/models/jandex/spi/JandexBuildingContextProvider.java @@ -41,7 +41,8 @@ public SourceModelBuildingContext produceContext( } private IndexView resolveJandexIndex(Map configProperties) { - // todo : here is where we need to figure out the best way to have the Jandex Index to available + // todo : do we want to have the ability to create the Jandex index or resolve one from another source? + // - note: if building, be sure to apply BaseLineJavaTypes return (IndexView) configProperties.get( INDEX_PARAM ); } } diff --git a/hibernate-models/src/main/java/org/hibernate/models/internal/BaseLineJavaTypes.java b/hibernate-models/src/main/java/org/hibernate/models/internal/BaseLineJavaTypes.java index da92644..816690c 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/internal/BaseLineJavaTypes.java +++ b/hibernate-models/src/main/java/org/hibernate/models/internal/BaseLineJavaTypes.java @@ -52,8 +52,7 @@ import org.hibernate.models.spi.ClassDetailsRegistry; /** - * Base set of classes used to prime the {@link ClassDetailsRegistry} - * and prime the Jandex {@link org.jboss.jandex.Indexer} (if we are creating the index). + * Base set of classes used to prime the {@link ClassDetailsRegistry}.. * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/AnnotationUsage.java b/hibernate-models/src/main/java/org/hibernate/models/spi/AnnotationUsage.java deleted file mode 100644 index 211e59e..0000000 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/AnnotationUsage.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * SPDX-License-Identifier: Apache-2.0 - * Copyright: Red Hat Inc. and Hibernate Authors - */ - -package org.hibernate.models.spi; - -import java.lang.annotation.Annotation; - -/** - * Describes the usage of an {@linkplain AnnotationDescriptor annotation class} on one of its - * allowable {@linkplain AnnotationTarget targets} where the source of the data is read from - * something other than Java reflection. In other words, an abstraction of an annotation usage - * not read via {@linkplain java.lang.annotation.Annotation}. - *

- * The standard way to access values is using {@linkplain #getAttributeValue}. - * - * @author Steve Ebersole - */ -public interface AnnotationUsage { - /** - * Descriptor for the type of the used annotation - */ - AnnotationDescriptor getAnnotationDescriptor(); - - /** - * Type of the used annotation - */ - default Class getAnnotationType() { - return getAnnotationDescriptor().getAnnotationType(); - } - - /** - * The target where this usage occurs - */ - AnnotationTarget getAnnotationTarget(); - - /** - * Create an Annotation representation of this usage - */ - A toAnnotation(); - - /** - * The value of the named annotation attribute - */ - V findAttributeValue(String name); - - /** - * The value of the named annotation attribute - */ - default V getAttributeValue(String name) { - final Object value = findAttributeValue( name ); - if ( value == null ) { - // this is unusual. make sure the attribute exists. - // NOTE : the call to #getAttribute throws the exception if it does not - getAnnotationDescriptor().getAttribute( name ); - } - //noinspection unchecked - return (V) value; - } -} diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/ArrayTypeDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/ArrayTypeDetails.java index 0184cc5..6658ce9 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/ArrayTypeDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/ArrayTypeDetails.java @@ -10,8 +10,6 @@ /** * Models a Java array type. * - * @see org.jboss.jandex.ArrayType - * * @author Steve Ebersole */ public interface ArrayTypeDetails extends ClassBasedTypeDetails { diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/ClassTypeDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/ClassTypeDetails.java index f7b55a2..b31d487 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/ClassTypeDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/ClassTypeDetails.java @@ -11,7 +11,6 @@ * Models a class type. * * @see Class - * @see org.jboss.jandex.ClassType * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/ParameterizedTypeDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/ParameterizedTypeDetails.java index 7cebfc8..618a5a3 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/ParameterizedTypeDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/ParameterizedTypeDetails.java @@ -18,7 +18,6 @@ * * * @see java.lang.reflect.ParameterizedType - * @see org.jboss.jandex.ParameterizedType * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/PrimitiveTypeDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/PrimitiveTypeDetails.java index 67a0d0a..0c7de45 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/PrimitiveTypeDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/PrimitiveTypeDetails.java @@ -13,7 +13,6 @@ * Models a primitive type * * @see Class#isPrimitive - * @see org.jboss.jandex.PrimitiveType * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/SourceModelBuildingContext.java b/hibernate-models/src/main/java/org/hibernate/models/spi/SourceModelBuildingContext.java index ddbbab6..eebaddc 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/SourceModelBuildingContext.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/SourceModelBuildingContext.java @@ -9,8 +9,6 @@ /** * Context object used while building references for {@link AnnotationDescriptor}, * {@link ClassDetails} and friends. - *

- * Acts as the global {@linkplain SharedAnnotationScope} * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeDetailsSwitch.java b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeDetailsSwitch.java index 479c474..544a848 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeDetailsSwitch.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeDetailsSwitch.java @@ -8,9 +8,14 @@ package org.hibernate.models.spi; /** + * Contract used in interpreting generics details. + * * @author Steve Ebersole */ public interface TypeDetailsSwitch { + /** + * Main entry into the generics interpretation, with delegation to the defined case methods + */ static T switchType(TypeDetails typeDetails, TypeDetailsSwitch switcher, SourceModelBuildingContext buildingContext) { switch( typeDetails.getTypeKind() ) { case CLASS -> { @@ -43,21 +48,48 @@ static T switchType(TypeDetails typeDetails, TypeDetailsSwitch switcher, } } + /** + * Handle the case of a raw class + */ T caseClass(ClassTypeDetails classType, SourceModelBuildingContext buildingContext); + /** + * Handle the case of a primitive + */ T casePrimitive(PrimitiveTypeDetails primitiveType, SourceModelBuildingContext buildingContext); + /** + * Handle the case of void (or Void) + */ T caseVoid(VoidTypeDetails voidType, SourceModelBuildingContext buildingContext); + /** + * Handle the case of a parameterized type + */ T caseParameterizedType(ParameterizedTypeDetails parameterizedType, SourceModelBuildingContext buildingContext); + /** + * Handle the case of a wildcard type + */ T caseWildcardType(WildcardTypeDetails wildcardType, SourceModelBuildingContext buildingContext); + /** + * Handle the case of a type variable + */ T caseTypeVariable(TypeVariableDetails typeVariable, SourceModelBuildingContext buildingContext); + /** + * Handle the case of a reference to a type variable + */ T caseTypeVariableReference(TypeVariableReferenceDetails typeVariableReference, SourceModelBuildingContext buildingContext); + /** + * Handle the case of an array + */ T caseArrayType(ArrayTypeDetails arrayType, SourceModelBuildingContext buildingContext); + /** + * Handle any other cases + */ T defaultCase(TypeDetails type, SourceModelBuildingContext buildingContext); } diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableDetails.java index 39bb5bd..20a81b5 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableDetails.java @@ -23,7 +23,6 @@ * In this case, the identifier is {@code T}, while the name is {@code java.lang.Number}. * * @see java.lang.reflect.TypeVariable - * @see org.jboss.jandex.TypeVariable * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableReferenceDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableReferenceDetails.java index da73d72..56eab63 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableReferenceDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/TypeVariableReferenceDetails.java @@ -29,8 +29,6 @@ * @apiNote This split between {@linkplain TypeVariableDetails} and {@linkplain TypeVariableReferenceDetails} * helps protect against stack overflows while processing generics. * - * @see org.jboss.jandex.TypeVariableReference - * * @author Steve Ebersole */ public interface TypeVariableReferenceDetails extends TypeDetails { diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/ValueTypeDescriptor.java b/hibernate-models/src/main/java/org/hibernate/models/spi/ValueTypeDescriptor.java index c265173..19b67c2 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/ValueTypeDescriptor.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/ValueTypeDescriptor.java @@ -13,7 +13,7 @@ /** * Descriptor for the annotation attribute types, acting as a producer for - * {@link AttributeDescriptor}, {@link JandexValueConverter} and {@link JandexValueExtractor} references + * {@link AttributeDescriptor}, {@link JdkValueConverter} and {@link JdkValueExtractor} references * * @author Steve Ebersole */ diff --git a/hibernate-models/src/main/java/org/hibernate/models/spi/WildcardTypeDetails.java b/hibernate-models/src/main/java/org/hibernate/models/spi/WildcardTypeDetails.java index bc8c50a..2905e10 100644 --- a/hibernate-models/src/main/java/org/hibernate/models/spi/WildcardTypeDetails.java +++ b/hibernate-models/src/main/java/org/hibernate/models/spi/WildcardTypeDetails.java @@ -13,7 +13,6 @@ * Models a wildcard type declaration. * * @see java.lang.reflect.WildcardType - * @see org.jboss.jandex.WildcardType * * @author Steve Ebersole */