@Test public void testFactoryRegistration() { RandomObject1 obj = new RandomObject1("foo"); RecordAccessor accessor = RecordAccessorProviderFactory.getRecordAccessorForObject(obj); Assert.assertNotNull(accessor); Assert.assertTrue(accessor instanceof TestAccessor); }
public synchronized static RecordAccessor getRecordAccessorForObject(Object obj) { for (RecordAccessorProvider p: recordAccessorProviders) { RecordAccessor accessor = p.recordAccessorForObject(obj); if (accessor != null) { return accessor; } } throw new IllegalArgumentException("Can't build accessor for object " + obj.toString() + "!"); }
RecordAccessorProviderFactory { public synchronized static RecordAccessor getRecordAccessorForObject(Object obj) { for (RecordAccessorProvider p: recordAccessorProviders) { RecordAccessor accessor = p.recordAccessorForObject(obj); if (accessor != null) { return accessor; } } throw new IllegalArgumentException("Can't build accessor for object " + obj.toString() + "!"); } }
RecordAccessorProviderFactory { public synchronized static RecordAccessor getRecordAccessorForObject(Object obj) { for (RecordAccessorProvider p: recordAccessorProviders) { RecordAccessor accessor = p.recordAccessorForObject(obj); if (accessor != null) { return accessor; } } throw new IllegalArgumentException("Can't build accessor for object " + obj.toString() + "!"); }  }
RecordAccessorProviderFactory { public synchronized static RecordAccessor getRecordAccessorForObject(Object obj) { for (RecordAccessorProvider p: recordAccessorProviders) { RecordAccessor accessor = p.recordAccessorForObject(obj); if (accessor != null) { return accessor; } } throw new IllegalArgumentException("Can't build accessor for object " + obj.toString() + "!"); }  synchronized static RecordAccessor getRecordAccessorForObject(Object obj); }
RecordAccessorProviderFactory { public synchronized static RecordAccessor getRecordAccessorForObject(Object obj) { for (RecordAccessorProvider p: recordAccessorProviders) { RecordAccessor accessor = p.recordAccessorForObject(obj); if (accessor != null) { return accessor; } } throw new IllegalArgumentException("Can't build accessor for object " + obj.toString() + "!"); }  synchronized static RecordAccessor getRecordAccessorForObject(Object obj);  }