1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.cubby.dxo;
17
18 import org.seasar.cubby.action.FormatPattern;
19 import org.seasar.cubby.action.impl.FormatPatternImpl;
20 import org.seasar.extension.dxo.annotation.AnnotationReader;
21 import org.seasar.extension.dxo.annotation.AnnotationReaderFactory;
22 import org.seasar.framework.container.S2Container;
23
24 public class CubbyAnnotationReaderFactoryImpl implements
25 AnnotationReaderFactory {
26
27 private AnnotationReaderFactory annotationReaderFactory;
28
29 private final FormatPattern formatPattern;
30
31 public CubbyAnnotationReaderFactoryImpl(final S2Container container) {
32 if (container.getRoot().hasComponentDef(FormatPattern.class)) {
33 this.formatPattern = (FormatPattern) container.getRoot().getComponent(FormatPattern.class);
34 } else {
35 this.formatPattern = new FormatPatternImpl();
36 }
37 }
38
39 public void setAnnotationReaderFactory(final AnnotationReaderFactory annotationReaderFactory) {
40 this.annotationReaderFactory = annotationReaderFactory;
41 }
42
43 public AnnotationReader getAnnotationReader() {
44 final AnnotationReader annotationReader = annotationReaderFactory
45 .getAnnotationReader();
46 return new CubbyAnnotationReaderWrapper(annotationReader, formatPattern);
47 }
48
49 }