@Test public void testSimple() { final Map<String, EntityManagerFactory> factories = createFactories(""); final PersistenceContextAnnotationProcessor p = new PersistenceContextAnnotationProcessor(factories); final PersistenceContext annotation = createAnnotation(""); final Provider<EntityManager> provider = p.buildProvider(null, EntityManager.class, new Annotation[] { annotation }); assertNotNull(provider); }
@Override @SuppressWarnings("unchecked") public MinijaxProvider<EntityManager> buildProvider( final MinijaxInjectorState state, final Class<EntityManager> type, final Annotation[] annotations) { final PersistenceContext persistenceContext = getPersistenceContextAnnotation(annotations); final EntityManagerFactory emf = factories.get(persistenceContext.name()); if (emf == null) { throw new InjectionException("Persistence context \"" + persistenceContext.name() + "\" not found"); } return new EntityManagerProvider(emf); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { @Override @SuppressWarnings("unchecked") public MinijaxProvider<EntityManager> buildProvider( final MinijaxInjectorState state, final Class<EntityManager> type, final Annotation[] annotations) { final PersistenceContext persistenceContext = getPersistenceContextAnnotation(annotations); final EntityManagerFactory emf = factories.get(persistenceContext.name()); if (emf == null) { throw new InjectionException("Persistence context \"" + persistenceContext.name() + "\" not found"); } return new EntityManagerProvider(emf); } }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { @Override @SuppressWarnings("unchecked") public MinijaxProvider<EntityManager> buildProvider( final MinijaxInjectorState state, final Class<EntityManager> type, final Annotation[] annotations) { final PersistenceContext persistenceContext = getPersistenceContextAnnotation(annotations); final EntityManagerFactory emf = factories.get(persistenceContext.name()); if (emf == null) { throw new InjectionException("Persistence context \"" + persistenceContext.name() + "\" not found"); } return new EntityManagerProvider(emf); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { @Override @SuppressWarnings("unchecked") public MinijaxProvider<EntityManager> buildProvider( final MinijaxInjectorState state, final Class<EntityManager> type, final Annotation[] annotations) { final PersistenceContext persistenceContext = getPersistenceContextAnnotation(annotations); final EntityManagerFactory emf = factories.get(persistenceContext.name()); if (emf == null) { throw new InjectionException("Persistence context \"" + persistenceContext.name() + "\" not found"); } return new EntityManagerProvider(emf); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); @Override @SuppressWarnings("unchecked") MinijaxProvider<EntityManager> buildProvider(
            final MinijaxInjectorState state,
            final Class<EntityManager> type,
            final Annotation[] annotations); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { @Override @SuppressWarnings("unchecked") public MinijaxProvider<EntityManager> buildProvider( final MinijaxInjectorState state, final Class<EntityManager> type, final Annotation[] annotations) { final PersistenceContext persistenceContext = getPersistenceContextAnnotation(annotations); final EntityManagerFactory emf = factories.get(persistenceContext.name()); if (emf == null) { throw new InjectionException("Persistence context \"" + persistenceContext.name() + "\" not found"); } return new EntityManagerProvider(emf); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); @Override @SuppressWarnings("unchecked") MinijaxProvider<EntityManager> buildProvider(
            final MinijaxInjectorState state,
            final Class<EntityManager> type,
            final Annotation[] annotations);  }