use of org.apache.tapestry5.commons.internal.util.TapestryException in project tapestry-5 by apache.
the class ComponentWorker method addMixinClasses.
private void addMixinClasses(PlasticField field, MutableEmbeddedComponentModel model) {
MixinClasses annotation = field.getAnnotation(MixinClasses.class);
if (annotation == null)
return;
boolean orderEmpty = annotation.order().length == 0;
if (!orderEmpty && annotation.order().length != annotation.value().length)
throw new TapestryException(String.format("%d mixins defined via @MixinClasses on field '%s', but %d ordering constraints \\\n" + " specified (expected 0 or %1$d).", annotation.value().length, field.getName(), annotation.order().length), model, null);
for (int i = 0; i < annotation.value().length; i++) {
String[] constraints = orderEmpty ? CommonsUtils.EMPTY_STRING_ARRAY : TapestryInternalUtils.splitMixinConstraints(annotation.order()[i]);
model.addMixin(annotation.value()[i].getName(), constraints);
}
}
use of org.apache.tapestry5.commons.internal.util.TapestryException in project tapestry-5 by apache.
the class ComponentPageElementImpl method addEmbeddedElement.
void addEmbeddedElement(ComponentPageElement child) {
if (children == null)
children = CollectionFactory.newList();
String childId = child.getId();
for (ComponentPageElement existing : children) {
if (existing.getId().equalsIgnoreCase(childId))
throw new TapestryException(StructureMessages.duplicateChildComponent(this, childId), child, new TapestryException(StructureMessages.originalChildComponent(this, childId, existing.getLocation()), existing, null));
}
children.add(child);
}
Aggregations