CountConstraint does not show any error message [message #1064089] |
Mon, 17 June 2013 14:51 |
kon f Messages: 152 Registered: March 2012 |
Senior Member |
|
|
Hey,
trying to use some count constraint on my root element - somehow it does not show any error message if the constraint is violated.
import org.eclipse.sapphire.modeling.IModelElement;
import org.eclipse.sapphire.modeling.ListProperty;
import org.eclipse.sapphire.modeling.ModelElementList;
import org.eclipse.sapphire.modeling.ModelElementType;
import org.eclipse.sapphire.modeling.annotations.CountConstraint;
import org.eclipse.sapphire.modeling.annotations.GenerateImpl;
import org.eclipse.sapphire.modeling.annotations.Label;
import org.eclipse.sapphire.modeling.annotations.Type;
import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding;
import org.eclipse.sapphire.modeling.xml.annotations.XmlListBinding;
import org.eclipse.sapphire.modeling.xml.annotations.XmlNamespace;
import org.eclipse.sapphire.modeling.xml.annotations.XmlSchema;
@GenerateImpl
@XmlNamespace(uri = "http://www.example.org/TestSystem")
@XmlSchema(namespace = "http://www.example.org/TestSystem", location = "http://www.example.org/TestSystem/1.0")
@XmlBinding(path = "root")
public interface Root extends IModelElement {
ModelElementType TYPE = new ModelElementType(Root.class);
// *** Description ***
// @formatter:off
@CountConstraint(min = 1)
@Type(base = DescriptionBase.class, possible = { DescriptionA.class, DescriptionB.class, DescriptionC.class, DescriptionD.class })
@XmlListBinding
(
path = "descriptions",
mappings =
{
@XmlListBinding.Mapping(element = "a", type = DescriptionA.class),
@XmlListBinding.Mapping(element = "b", type = DescriptionB.class),
@XmlListBinding.Mapping(element = "c", type = DescriptionC.class),
@XmlListBinding.Mapping(element = "d", type = DescriptionD.class)
}
)
ListProperty PROP_DESCRIPTION_BASE = new ListProperty(TYPE, "DescriptionBase");
ModelElementList<DescriptionBase> getDescriptionBase();
// @formatter:on
// *** Item ***
@Type(base = Item.class)
@Label(standard = "items")
@CountConstraint(min = 1)
@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "item", type = Item.class))
ListProperty PROP_ITEMS = new ListProperty(TYPE, "Items");
ModelElementList<Item> getItems();
}
If I start with some plain xml file, no error message is given. Both list properties violate the constraint since both have zero children.
The strange part is, that I already use the count constraint on list properties in my application. It is further down in the hierarchy (in the Item.class). Apparently, the count constraint just doesn't work on the root element. Or am I doing something wrong? Thank you.
Best regards,
Kon
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04411 seconds