@Test public void testGetSectionId() { assertThat(Sections.getSectionId(new SectionPmoWithoutId()), is(SectionPmoWithoutId.class.getSimpleName())); TestSectionPmo testSectionPmo = new TestSectionPmo(); testSectionPmo.setId("foo"); assertThat(Sections.getSectionId(testSectionPmo), is("foo")); }
public static String getSectionId(Object pmo) { Optional<Method> idMethod = BeanUtils.getMethod(pmo.getClass(), (m) -> m.isAnnotationPresent(SectionID.class)); return idMethod.map(m -> getIdFromSectionIdMethod(pmo, m)).orElse(pmo.getClass().getSimpleName()); }
Sections { public static String getSectionId(Object pmo) { Optional<Method> idMethod = BeanUtils.getMethod(pmo.getClass(), (m) -> m.isAnnotationPresent(SectionID.class)); return idMethod.map(m -> getIdFromSectionIdMethod(pmo, m)).orElse(pmo.getClass().getSimpleName()); } }
Sections { public static String getSectionId(Object pmo) { Optional<Method> idMethod = BeanUtils.getMethod(pmo.getClass(), (m) -> m.isAnnotationPresent(SectionID.class)); return idMethod.map(m -> getIdFromSectionIdMethod(pmo, m)).orElse(pmo.getClass().getSimpleName()); } private  Sections(); }
Sections { public static String getSectionId(Object pmo) { Optional<Method> idMethod = BeanUtils.getMethod(pmo.getClass(), (m) -> m.isAnnotationPresent(SectionID.class)); return idMethod.map(m -> getIdFromSectionIdMethod(pmo, m)).orElse(pmo.getClass().getSimpleName()); } private  Sections(); static String getSectionId(Object pmo); static Optional<ButtonPmo> getEditButtonPmo(Object pmo); }
Sections { public static String getSectionId(Object pmo) { Optional<Method> idMethod = BeanUtils.getMethod(pmo.getClass(), (m) -> m.isAnnotationPresent(SectionID.class)); return idMethod.map(m -> getIdFromSectionIdMethod(pmo, m)).orElse(pmo.getClass().getSimpleName()); } private  Sections(); static String getSectionId(Object pmo); static Optional<ButtonPmo> getEditButtonPmo(Object pmo);  }