private void updateAttachmentPredicate(M template, Attachment attachment, MutableAttachedTemplate attachedTemplate) { String predicate = attachment.predicate(); if(predicate!=null && predicate.length()>0) { try { attachedTemplate.setPredicate(createOptionalURI(template.id(),predicate,"The attachment predicate")); } catch (TemplateCreationException e) { throw new InvalidAttachmentDefinitionException( template.id(), attachment.id(), String.format("Attachment predicate value '%s' of attached template '%s' is not valid",predicate,attachedTemplate.id()), e); } } }
protected void doPostprocess(A annotation, M template, TemplateResolver resolver) { for(Attachment attachment:attachments(annotation)) { try { MutableAttachedTemplate attachedTemplate = template.attachTemplate(attachment.id(), resolver.resolve(attachment.handler()), attachment.path()); updateAttachmentPredicate(template,attachment,attachedTemplate); } catch (IllegalArgumentException e) { throw new InvalidAttachmentDefinitionException(template.id(),attachment.id(),"Invalid attachment definition",e); } } }