On 21 November 2015 at 20:21, Kevin Meyer <[email protected]> wrote: > Following up on this, I seem to be missing something. > > In my PanelFactory, I am trying to detect an annotation. I have the > following: > > @Override > protected ApplicationAdvice appliesTo(IModel<?> model) { > if (model instanceof ScalarModel) { > Object obj = model.getObject(); > if (obj != null) { > if (obj instanceof PojoAdapter) { > PojoAdapter po = (PojoAdapter) obj; > > System.out.println(po.getSpecification().getCorrespondingClass().getName()); > if > > (po.getSpecification().getCorrespondingClass().isAnnotationPresent(Html.class)) > { > return > ApplicationAdvice.APPLIES; > } > } > } > } > return ApplicationAdvice.DOES_NOT_APPLY; > } > > But it is not detecting my annotation on the field: > > // {{ Description (property) > @Column(allowsNull = "false") > @PropertyLayout( multiLine = 10, typicalLength = 80) > @Html > private String description; > > Your PanelFactory is looking for the @Html annotation on a class definition, not on a field definition.
> > I remember something about facts, should I rather be working with them? > > Facets, (I presume you mis-spelt). Yes, that would usually be the pattern; write an HtmlFacetFactory to install a corresponding HtmlFacet, added to the property. in the Wicket UI, subclass ComponentFactoryScalarAbstract and in the applesTo override to also check that scalarModel.containsFacet(HtmlFacet.class). HTH Dan > Regards, > Kevin > > > > -- > Kevin Meyer > Ljubljana, Slovenia > > >
