Search in sources :

Example 1 with MixinClasses

use of org.apache.tapestry5.annotations.MixinClasses 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);
    }
}
Also used : MixinClasses(org.apache.tapestry5.annotations.MixinClasses) TapestryException(org.apache.tapestry5.commons.internal.util.TapestryException)

Aggregations

MixinClasses (org.apache.tapestry5.annotations.MixinClasses)1 TapestryException (org.apache.tapestry5.commons.internal.util.TapestryException)1