@Test public void testAddDescriptor_DualDifferentPosition() { PropertyElementDescriptors descriptors = new PropertyElementDescriptors( TestPmo.ILLEGAL_DUAL_PMO_PROPERTY_WITH_DIFFERENT_POSITION); Assertions.assertThrows(IllegalStateException.class, () -> { descriptors.addDescriptor(TestUIAnnotation.class, new ElementDescriptor(30, TestLinkkiComponentDefinition.create(() -> "TestUIAnnotation"), BoundProperty .of(TestPmo.ILLEGAL_DUAL_PMO_PROPERTY_WITH_DIFFERENT_POSITION), Collections.emptyList()), TestPmo.class); descriptors.addDescriptor(AnotherTestUIAnnotation.class, new ElementDescriptor(31, TestLinkkiComponentDefinition.create(() -> "AnotherTestUIAnnotation"), BoundProperty .of(TestPmo.ILLEGAL_DUAL_PMO_PROPERTY_WITH_DIFFERENT_POSITION), 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();  }