use of org.apache.tapestry5.model.MutableEmbeddedComponentModel 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.model.MutableEmbeddedComponentModel in project tapestry-5 by apache.
the class ComponentWorker method addMixinTypes.
private void addMixinTypes(PlasticField field, MutableEmbeddedComponentModel model) {
Mixins annotation = field.getAnnotation(Mixins.class);
if (annotation == null)
return;
for (String typeName : annotation.value()) {
Orderable<String> typeAndOrder = TapestryInternalUtils.mixinTypeAndOrder(typeName);
String mixinClassName = resolver.resolveMixinTypeToClassName(typeAndOrder.getTarget());
model.addMixin(mixinClassName, typeAndOrder.getConstraints());
}
}
Aggregations