private void checkForAnalyzerDiscriminator(XAnnotatedElement annotatedElement,
TypeMetadata.Builder typeMetadataBuilder,
ConfigContext context) {
AnalyzerDiscriminator discriminatorAnnotation = annotatedElement.getAnnotation( AnalyzerDiscriminator.class );
if ( discriminatorAnnotation == null ) {
return;
}
if ( annotatedElement instanceof XProperty && isPropertyTransient( (XProperty) annotatedElement, context ) ) {
//if the discriminator is calculated on a @Transient field, we can't trust field level dirtyness
typeMetadataBuilder.disableStateInspectionOptimization();
}
Class<? extends Discriminator> discriminatorClass = discriminatorAnnotation.impl();
Discriminator discriminator = ClassLoaderHelper.instanceFromClass( Discriminator.class, discriminatorClass, "analyzer discriminator implementation" );
if ( annotatedElement instanceof XMember ) {
typeMetadataBuilder.analyzerDiscriminator( discriminator, (XMember) annotatedElement );
}