@PostConstruct public void init() throws ClassNotFoundException { final Configuration configuration = annotationSessionFactory .getConfiguration(); final ReflectionManager reflectionManager = configuration .getReflectionManager(); final Iterator<PersistentClass> classMappings = configuration .getClassMappings(); while (classMappings.hasNext()) { entityCallbackHandler.add(reflectionManager.classForName( classMappings.next().getClassName(), this.getClass()), reflectionManager); } }
/** * For the mapped entities build some temporary data-structure containing information about the * inheritance status of a class. * * @param orderedClasses Order list of all annotated entities and their mapped superclasses * * @return A map of {@code InheritanceState}s keyed against their {@code XClass}. */ public static Map<XClass, InheritanceState> buildInheritanceStates( List<XClass> orderedClasses, Mappings mappings) { ReflectionManager reflectionManager = mappings.getReflectionManager(); Map<XClass, InheritanceState> inheritanceStatePerClass = new HashMap<XClass, InheritanceState>( orderedClasses.size() ); for ( XClass clazz : orderedClasses ) { InheritanceState superclassState = InheritanceState.getSuperclassInheritanceState( clazz, inheritanceStatePerClass ); InheritanceState state = new InheritanceState( clazz, inheritanceStatePerClass, mappings ); if ( superclassState != null ) { //the classes are ordered thus preventing an NPE //FIXME if an entity has subclasses annotated @MappedSperclass wo sub @Entity this is wrong superclassState.setHasSiblings( true ); InheritanceState superEntityState = InheritanceState.getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass ); state.setHasParents( superEntityState != null ); final boolean nonDefault = state.getType() != null && !InheritanceType.SINGLE_TABLE .equals( state.getType() ); if ( superclassState.getType() != null ) { final boolean mixingStrategy = state.getType() != null && !state.getType() .equals( superclassState.getType() ); if ( nonDefault && mixingStrategy ) { LOG.invalidSubStrategy( clazz.getName() ); } state.setType( superclassState.getType() ); } } inheritanceStatePerClass.put( clazz, state ); } return inheritanceStatePerClass; }
/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
@Override public ReflectionManager getReflectionManager() { return null; }
public ReflectionManager getReflectionManager() { return reflectionManager; }
@Override public ReflectionManager getReflectionManager() { return this.reflectionManager; }
public ReflectionManager getReflectionManager();