/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { boolean result=super.equals(obj); if(result && this.getClass()==obj.getClass()) { MutableContainerTemplate that = (MutableContainerTemplate) obj; result= Objects.equals(this.memberTemplate, that.memberTemplate) && Objects.equals(this.memberPath, that.memberPath); } return result; }
/** * {@inheritDoc} */ @Override public int hashCode() { return Objects. hash(super.hashCode(),this.memberTemplate,this.memberPath); }
/** * {@inheritDoc} */ @Override public String toString() { return stringHelper(). toString(); }
protected M doProcess(A annotation, Class<? extends R> handler) { M template = createTemplate(annotation,handler); template.setName(nullable(name(annotation))); template.setDescription(nullable(description(annotation))); return template; }
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); } } }
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); } } }
/** * {@inheritDoc} */ @Override protected ToStringHelper stringHelper() { return super. stringHelper(). add("memberTemplate",this.memberTemplate.id()). add("memberPath",this.memberPath); }