1 package org.starobjects.wicket.metamodel.facets;
2
3
4 import java.lang.reflect.Method;
5
6 import org.nakedobjects.metamodel.facets.FacetHolder;
7 import org.nakedobjects.metamodel.facets.FacetUtil;
8 import org.nakedobjects.metamodel.facets.MethodRemover;
9 import org.nakedobjects.metamodel.java5.AnnotationBasedFacetFactoryAbstract;
10 import org.nakedobjects.metamodel.spec.feature.NakedObjectFeatureType;
11 import org.starobjects.wicket.applib.WizardPageDescription;
12
13
14 public class WizardPageDescriptionAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
15
16 public WizardPageDescriptionAnnotationFacetFactory() {
17 super(NakedObjectFeatureType.PROPERTIES_ONLY);
18 }
19
20 @Override
21 public boolean process(Class<?> cls, final Method method, final MethodRemover methodRemover, final FacetHolder holder) {
22
23
24 final WizardPageDescription annotation = getAnnotation(method, WizardPageDescription.class);
25 WizardPageDescriptionFacet facet = create(annotation, holder);
26 if (facet != null) {
27 return FacetUtil.addFacet(facet);
28 }
29
30 return false;
31 }
32
33 private WizardPageDescriptionFacet create(final WizardPageDescription annotation, final FacetHolder holder) {
34 return annotation == null ? null : new WizardPageDescriptionFacetAnnotation(holder);
35 }
36
37 }