rename to AnnotationBasedGenerator

This commit is contained in:
Gavin 2022-11-30 17:36:00 +01:00 committed by Gavin King
parent a67cfd039e
commit 2b50997e71
6 changed files with 10 additions and 11 deletions

View File

@ -10,7 +10,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.hibernate.tuple.AnnotationGenerator; import org.hibernate.tuple.AnnotationBasedGenerator;
import org.hibernate.tuple.Generator; import org.hibernate.tuple.Generator;
import org.hibernate.tuple.InDatabaseGenerator; import org.hibernate.tuple.InDatabaseGenerator;
import org.hibernate.tuple.InMemoryGenerator; import org.hibernate.tuple.InMemoryGenerator;
@ -57,7 +57,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* </ul> * </ul>
* A generator annotation may have members, which are used to configure the * A generator annotation may have members, which are used to configure the
* generation strategy, when the strategy instance in initialized via * generation strategy, when the strategy instance in initialized via
* {@link AnnotationGenerator#initialize}. * {@link AnnotationBasedGenerator#initialize}.
* <p> * <p>
* There are several excellent examples of the use of this machinery right * There are several excellent examples of the use of this machinery right
* here in this package. {@link TenantId} and its corresponding generator * here in this package. {@link TenantId} and its corresponding generator
@ -69,7 +69,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* @see Generator * @see Generator
* @see InMemoryGenerator * @see InMemoryGenerator
* @see InDatabaseGenerator * @see InDatabaseGenerator
* @see AnnotationGenerator * @see AnnotationBasedGenerator
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
@ -81,7 +81,7 @@ public @interface ValueGenerationType {
* <p> * <p>
* If the generator annotation has members used to configure the * If the generator annotation has members used to configure the
* generation strategy instance, the strategy should implement * generation strategy instance, the strategy should implement
* {@link AnnotationGenerator}. * {@link AnnotationBasedGenerator}.
*/ */
Class<? extends Generator> generatedBy(); Class<? extends Generator> generatedBy();
} }

View File

@ -44,7 +44,7 @@ import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value; import org.hibernate.mapping.Value;
import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.property.access.spi.PropertyAccessStrategy; import org.hibernate.property.access.spi.PropertyAccessStrategy;
import org.hibernate.tuple.AnnotationGenerator; import org.hibernate.tuple.AnnotationBasedGenerator;
import org.hibernate.tuple.Generator; import org.hibernate.tuple.Generator;
import org.hibernate.tuple.AttributeBinder; import org.hibernate.tuple.AttributeBinder;
import org.hibernate.tuple.GeneratorCreationContext; import org.hibernate.tuple.GeneratorCreationContext;
@ -495,12 +495,12 @@ public class PropertyBinder {
Member member, Member member,
GeneratorCreationContext creationContext, GeneratorCreationContext creationContext,
Generator generator) { Generator generator) {
if ( generator instanceof AnnotationGenerator) { if ( generator instanceof AnnotationBasedGenerator) {
// This will cause a CCE in case the generation type doesn't match the annotation type; As this would be // This will cause a CCE in case the generation type doesn't match the annotation type; As this would be
// a programming error of the generation type developer and thus should show up during testing, we don't // a programming error of the generation type developer and thus should show up during testing, we don't
// check this explicitly; If required, this could be done e.g. using ClassMate // check this explicitly; If required, this could be done e.g. using ClassMate
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final AnnotationGenerator<A> generation = (AnnotationGenerator<A>) generator; final AnnotationBasedGenerator<A> generation = (AnnotationBasedGenerator<A>) generator;
generation.initialize( annotation, member, creationContext ); generation.initialize( annotation, member, creationContext );
} }
} }

View File

@ -27,7 +27,7 @@ import java.lang.reflect.Member;
* *
* @since 6.2 * @since 6.2
*/ */
public interface AnnotationGenerator<A extends Annotation> extends Generator { public interface AnnotationBasedGenerator<A extends Annotation> extends Generator {
/** /**
* Initializes this generation strategy for the given annotation instance. * Initializes this generation strategy for the given annotation instance.
* *

View File

@ -24,7 +24,7 @@ import java.lang.reflect.Method;
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public interface AnnotationValueGeneration<A extends Annotation> public interface AnnotationValueGeneration<A extends Annotation>
extends ValueGeneration, AnnotationGenerator<A> { extends ValueGeneration, AnnotationBasedGenerator<A> {
/** /**
* Initializes this generation strategy for the given annotation instance. * Initializes this generation strategy for the given annotation instance.
* *

View File

@ -25,7 +25,7 @@ import java.io.Serializable;
* </ul> * </ul>
* If an implementation of {@code ValueGenerationStrategy} may be associated with an entity * If an implementation of {@code ValueGenerationStrategy} may be associated with an entity
* via a {@linkplain org.hibernate.annotations.ValueGenerationType custom annotation}, it * via a {@linkplain org.hibernate.annotations.ValueGenerationType custom annotation}, it
* should implement {@link AnnotationGenerator}. * should implement {@link AnnotationBasedGenerator}.
* *
* @see org.hibernate.annotations.ValueGenerationType * @see org.hibernate.annotations.ValueGenerationType
* @see org.hibernate.annotations.Generated * @see org.hibernate.annotations.Generated

View File

@ -19,7 +19,6 @@ import jakarta.persistence.Table;
import org.hibernate.annotations.ValueGenerationType; import org.hibernate.annotations.ValueGenerationType;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.tuple.AnnotationGenerator;
import org.hibernate.tuple.GenerationTiming; import org.hibernate.tuple.GenerationTiming;
import org.hibernate.tuple.InMemoryGenerator; import org.hibernate.tuple.InMemoryGenerator;