@Test public void testAddDescriptor_DifferentProperty() { PropertyElementDescriptors descriptors = new PropertyElementDescriptors(TestPmo.SINGLE_PMO_PROPERTY); Assertions.assertThrows(IllegalArgumentException.class, () -> { descriptors.addDescriptor(TestUIAnnotation.class, new ElementDescriptor(30, TestLinkkiComponentDefinition.create(() -> "TestUIAnnotation"), BoundProperty.of(TestPmo.DUAL_PMO_PROPERTY), Collections.emptyList()), TestPmo.class); }); }
void addDescriptor(Class<? extends Annotation> uiElementAnnotationType, ElementDescriptor descriptor, Class<?> pmoClass) { Validate.isTrue(pmoPropertyName.equals(descriptor.getPmoPropertyName()), String .format("Cannot add descriptor for property %s to PropertyElementDescriptors intended for property %s", descriptor.getPmoPropertyName(), pmoPropertyName)); if (descriptors.isEmpty()) { position = descriptor.getPosition(); } else { validateDynamicFieldDescriptor(descriptor, pmoClass); } descriptors.put(uiElementAnnotationType, descriptor); }
PropertyElementDescriptors { void addDescriptor(Class<? extends Annotation> uiElementAnnotationType, ElementDescriptor descriptor, Class<?> pmoClass) { Validate.isTrue(pmoPropertyName.equals(descriptor.getPmoPropertyName()), String .format("Cannot add descriptor for property %s to PropertyElementDescriptors intended for property %s", descriptor.getPmoPropertyName(), pmoPropertyName)); if (descriptors.isEmpty()) { position = descriptor.getPosition(); } else { validateDynamicFieldDescriptor(descriptor, pmoClass); } descriptors.put(uiElementAnnotationType, descriptor); } }
PropertyElementDescriptors { void addDescriptor(Class<? extends Annotation> uiElementAnnotationType, ElementDescriptor descriptor, Class<?> pmoClass) { Validate.isTrue(pmoPropertyName.equals(descriptor.getPmoPropertyName()), String .format("Cannot add descriptor for property %s to PropertyElementDescriptors intended for property %s", descriptor.getPmoPropertyName(), pmoPropertyName)); if (descriptors.isEmpty()) { position = descriptor.getPosition(); } else { validateDynamicFieldDescriptor(descriptor, pmoClass); } descriptors.put(uiElementAnnotationType, descriptor); } PropertyElementDescriptors(String pmoPropertyName); }
PropertyElementDescriptors { void addDescriptor(Class<? extends Annotation> uiElementAnnotationType, ElementDescriptor descriptor, Class<?> pmoClass) { Validate.isTrue(pmoPropertyName.equals(descriptor.getPmoPropertyName()), String .format("Cannot add descriptor for property %s to PropertyElementDescriptors intended for property %s", descriptor.getPmoPropertyName(), pmoPropertyName)); if (descriptors.isEmpty()) { position = descriptor.getPosition(); } else { validateDynamicFieldDescriptor(descriptor, pmoClass); } descriptors.put(uiElementAnnotationType, descriptor); } PropertyElementDescriptors(String pmoPropertyName); int getPosition(); String getPmoPropertyName(); ElementDescriptor getDescriptor(Object pmo); void addAspect(List<LinkkiAspectDefinition> aspectDefs); boolean isNotEmpty(); List<LinkkiAspectDefinition> getAllAspects(); }
PropertyElementDescriptors { void addDescriptor(Class<? extends Annotation> uiElementAnnotationType, ElementDescriptor descriptor, Class<?> pmoClass) { Validate.isTrue(pmoPropertyName.equals(descriptor.getPmoPropertyName()), String .format("Cannot add descriptor for property %s to PropertyElementDescriptors intended for property %s", descriptor.getPmoPropertyName(), pmoPropertyName)); if (descriptors.isEmpty()) { position = descriptor.getPosition(); } else { validateDynamicFieldDescriptor(descriptor, pmoClass); } descriptors.put(uiElementAnnotationType, descriptor); } PropertyElementDescriptors(String pmoPropertyName); int getPosition(); String getPmoPropertyName(); ElementDescriptor getDescriptor(Object pmo); void addAspect(List<LinkkiAspectDefinition> aspectDefs); boolean isNotEmpty(); List<LinkkiAspectDefinition> getAllAspects();  }