@SuppressWarnings("deprecation") private XClass toXClass(String className, ReflectionManager reflectionManager) { try { return reflectionManager.classForName( className ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to load class defined in XML: " + className, e ); } }
public ComponentPropertiesSource(ReflectionManager reflectionManager, Component component) { try { this.xclass = reflectionManager.classForName( component.getComponentClassName() ); } catch ( ClassLoadingException e ) { throw new MappingException( e ); } this.component = component; }
final XClass embeddableXClass = reflectionManager.classForName( embeddableClassName ); final Getter embeddableGetter = embeddableProperty.getGetter( entityClass ); final boolean debugEnabled = log.isDebugEnabled();
@Override public void buildCallbacksForEmbeddable( Property embeddableProperty, String entityClassName, CallbackRegistrar callbackRegistrar) { try { final XClass entityXClass = reflectionManager.classForName( entityClassName ); final Class entityClass = reflectionManager.toClass( entityXClass ); for ( CallbackType callbackType : CallbackType.values() ) { final Callback[] callbacks = resolveEmbeddableCallbacks( entityClass, embeddableProperty, callbackType, reflectionManager ); callbackRegistrar.registerCallbacks( entityClass, callbacks ); } } catch (ClassLoadingException e) { throw new MappingException( "Class not found: ", e ); } }
@Override public void buildCallbacksForEntity(String entityClassName, CallbackRegistrar callbackRegistrar) { final boolean debugEnabled = log.isDebugEnabled(); try { final XClass entityXClass = reflectionManager.classForName( entityClassName ); final Class entityClass = reflectionManager.toClass( entityXClass ); for ( CallbackType callbackType : CallbackType.values() ) { if ( callbackRegistrar.hasRegisteredCallbacks( entityClass, callbackType ) ) { // this most likely means we have a class mapped multiple times using the hbm.xml // "entity name" feature if ( debugEnabled ) { log.debugf( "CallbackRegistry reported that Class [%s] already had %s callbacks registered; " + "assuming this means the class was mapped twice " + "(using hbm.xml entity-name support) - skipping subsequent registrations", entityClassName, callbackType.getCallbackAnnotation().getSimpleName() ); } continue; } final Callback[] callbacks = resolveEntityCallbacks( entityXClass, callbackType, reflectionManager ); callbackRegistrar.registerCallbacks( entityClass, callbacks ); } } catch (ClassLoadingException e) { throw new MappingException( "entity class not found: " + entityClassName, e ); } }
public ClassAuditingData getAuditData() { if ( pc.getClassName() == null ) { return auditData; } try { final XClass xclass = reflectionManager.classForName( pc.getClassName() ); final ModificationStore defaultStore = getDefaultAudited( xclass ); if ( defaultStore != null ) { auditData.setDefaultAudited( true ); } new AuditedPropertiesReader( defaultStore, new PersistentClassPropertiesSource( xclass ), auditData, globalCfg, reflectionManager, "" ).read(); addAuditTable( xclass ); addAuditSecondaryTables( xclass ); } catch (ClassLoadingException e) { throw new MappingException( e ); } return auditData; }
static PropertyData getPropertyOverriddenByMapperOrMapsId( boolean isId, PropertyHolder propertyHolder, String propertyName, MetadataBuildingContext buildingContext) { final XClass persistentXClass; try { persistentXClass = buildingContext.getBootstrapContext().getReflectionManager() .classForName( propertyHolder.getPersistentClass().getClassName() ); } catch ( ClassLoadingException e ) { throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e); } if ( propertyHolder.isInIdClass() ) { PropertyData pd = buildingContext.getMetadataCollector().getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName ); if ( pd == null && buildingContext.getBuildingOptions().isSpecjProprietarySyntaxEnabled() ) { pd = buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyName ); } return pd; } String propertyPath = isId ? "" : propertyName; return buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath ); }
keyXClass = buildingContext.getBootstrapContext().getReflectionManager().classForName( mapKeyType );
XClass clazz; try { clazz = reflectionManager.classForName( persistentClass.getClassName() );
for ( String classname : classnames ) { try { annotatedClasses.add( reflectionManager.classForName( classname, this.getClass() ) );
static PropertyData getPropertyOverriddenByMapperOrMapsId(boolean isId, PropertyHolder propertyHolder, String propertyName, ExtendedMappings mappings) { final XClass persistentXClass; try { persistentXClass = mappings.getReflectionManager() .classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class ); } catch ( ClassNotFoundException e ) { throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e); } if ( propertyHolder.isInIdClass() ) { return mappings.getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName ); } else { String propertyPath = isId ? "" : propertyName; return mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath ); } } }
@SuppressWarnings("deprecation") private XClass toXClass(String className, ReflectionManager reflectionManager) { try { return reflectionManager.classForName( className ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to load class defined in XML: " + className, e ); } }
public ComponentPropertiesSource(ReflectionManager reflectionManager, Component component) { try { this.xclass = reflectionManager.classForName( component.getEmbeddableClassName() ); } catch ( ClassLoadingException e ) { throw new MappingException( e ); } this.component = component; }
elementClass = mappings.getReflectionManager().classForName( mapKeyType, MapBinder.class );
public void add(XmlDocument metadataXml) { if ( inSecondPass || !isOrmXml( metadataXml ) ) { metadataSourceQueue.add( metadataXml ); } else { final MetadataProvider metadataProvider = ( (MetadataProviderInjector) reflectionManager ).getMetadataProvider(); JPAMetadataProvider jpaMetadataProvider = ( JPAMetadataProvider ) metadataProvider; List<String> classNames = jpaMetadataProvider.getXMLContext().addDocument( metadataXml.getDocumentTree() ); for ( String className : classNames ) { try { metadataSourceQueue.add( reflectionManager.classForName( className, this.getClass() ) ); } catch ( ClassNotFoundException e ) { throw new AnnotationException( "Unable to load class defined in XML: " + className, e ); } } } }
public void add(XmlDocument metadataXml) { if ( inSecondPass || !isOrmXml( metadataXml ) ) { metadataSourceQueue.add( metadataXml ); } else { final MetadataProvider metadataProvider = ( (MetadataProviderInjector) reflectionManager ).getMetadataProvider(); JPAMetadataProvider jpaMetadataProvider = ( JPAMetadataProvider ) metadataProvider; List<String> classNames = jpaMetadataProvider.getXMLContext().addDocument( metadataXml.getDocumentTree() ); for ( String className : classNames ) { try { metadataSourceQueue.add( reflectionManager.classForName( className, this.getClass() ) ); } catch ( ClassNotFoundException e ) { throw new AnnotationException( "Unable to load class defined in XML: " + className, e ); } } } }
private ClassesAuditingData prepare(InFlightMetadataCollector metadata) { final ReflectionManager reflectionManager = metadata.getBootstrapContext().getReflectionManager(); final ClassesAuditingData classesAuditingData = new ClassesAuditingData(); final Iterator<PersistentClass> classes = sort( new PersistentClassGraphDefiner( metadata ) ).iterator(); while ( classes.hasNext() ) { final PersistentClass persistentClass = classes.next(); if ( persistentClass.getClassName() != null ) { try { final XClass clazz =reflectionManager.classForName( persistentClass.getClassName() ); final AnnotationsMetadataReader reader = new AnnotationsMetadataReader( auditMetadataBuilder.getAuditMetadataBuildingOptions(), reflectionManager, persistentClass, clazz ); classesAuditingData.addClassAuditingData( persistentClass, reader.getAuditData() ); } catch ( ClassLoadingException e ) { // todo: log a warning? } } } classesAuditingData.updateCalculatedFields(); return classesAuditingData; }
static PropertyData getPropertyOverriddenByMapperOrMapsId( boolean isId, PropertyHolder propertyHolder, String propertyName, Mappings mappings) { final XClass persistentXClass; try { persistentXClass = mappings.getReflectionManager() .classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class ); } catch ( ClassNotFoundException e ) { throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e); } if ( propertyHolder.isInIdClass() ) { PropertyData pd = mappings.getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName ); if ( pd == null && mappings.isSpecjProprietarySyntaxEnabled() ) { pd = mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyName ); } return pd; } String propertyPath = isId ? "" : propertyName; return mappings.getPropertyAnnotatedWithMapsId(persistentXClass, propertyPath); } }
static PropertyData getPropertyOverriddenByMapperOrMapsId( boolean isId, PropertyHolder propertyHolder, String propertyName, Mappings mappings) { final XClass persistentXClass; try { persistentXClass = mappings.getReflectionManager() .classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class ); } catch ( ClassNotFoundException e ) { throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e); } if ( propertyHolder.isInIdClass() ) { PropertyData pd = mappings.getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName ); if ( pd == null && mappings.isSpecjProprietarySyntaxEnabled() ) { pd = mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyName ); } return pd; } String propertyPath = isId ? "" : propertyName; return mappings.getPropertyAnnotatedWithMapsId(persistentXClass, propertyPath); } }
static PropertyData getPropertyOverriddenByMapperOrMapsId( boolean isId, PropertyHolder propertyHolder, String propertyName, MetadataBuildingContext buildingContext) { final XClass persistentXClass; try { persistentXClass = buildingContext.getBootstrapContext().getReflectionManager() .classForName( propertyHolder.getPersistentClass().getClassName() ); } catch ( ClassLoadingException e ) { throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e); } if ( propertyHolder.isInIdClass() ) { PropertyData pd = buildingContext.getMetadataCollector().getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName ); if ( pd == null && buildingContext.getBuildingOptions().isSpecjProprietarySyntaxEnabled() ) { pd = buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyName ); } return pd; } String propertyPath = isId ? "" : propertyName; return buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath ); }