@Test public void testMultipleBeanSource() throws IllegalArgumentException { FXForm fxForm = new FXForm(); fxForm.setSource(new MultipleBeanSource(new TestBean(), new TestBean2())); Assert.assertEquals(5, fxForm.getElements().size()); Assert.assertTrue(hasElement(fxForm.getElements(), "propInBean2")); Assert.assertTrue(hasElement(fxForm.getElements(), "stringProperty")); Assert.assertTrue(hasElement(fxForm.getElements(), "booleanProperty")); Assert.assertTrue(hasElement(fxForm.getElements(), "doubleProperty")); Assert.assertTrue(hasElement(fxForm.getElements(), "objectProperty")); }
public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type."); } declaringClasses.add(o.getClass()); } }
MultipleBeanSource { public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type."); } declaringClasses.add(o.getClass()); } } }
MultipleBeanSource { public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type."); } declaringClasses.add(o.getClass()); } } MultipleBeanSource(Object... sources); }
MultipleBeanSource { public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type."); } declaringClasses.add(o.getClass()); } } MultipleBeanSource(Object... sources); Object[] getSources(); Object getSource(Element element); }
MultipleBeanSource { public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type."); } declaringClasses.add(o.getClass()); } } MultipleBeanSource(Object... sources); Object[] getSources(); Object getSource(Element element);  }