01: package org.vraptor.component;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05: import java.util.List;
06: import java.util.Map;
07:
08: import org.vraptor.annotations.In;
09: import org.vraptor.interceptor.InterceptorType;
10: import org.vraptor.introspector.ReadParameter;
11: import org.vraptor.reflection.GettingException;
12: import org.vraptor.reflection.MethodInvocationException;
13: import org.vraptor.scope.ScopeType;
14:
15: /**
16: * A component wrapper.
17: *
18: * @author Guilherme Silveira
19: */
20: public class ComponentTypeWrapper implements ComponentType {
21:
22: private final ComponentType type;
23:
24: public ComponentTypeWrapper(ComponentType component) {
25: this .type = component;
26: }
27:
28: public List<FieldAnnotation<In>> getInAnnotations() {
29: return type.getInAnnotations();
30: }
31:
32: public List<InterceptorType> getInterceptors() {
33: return type.getInterceptors();
34: }
35:
36: public LogicMethod getLogic(String key)
37: throws LogicNotFoundException {
38: return type.getLogic(key);
39: }
40:
41: public String getName() {
42: return type.getName();
43: }
44:
45: public List<ReadParameter> getReadParameters() {
46: return type.getReadParameters();
47: }
48:
49: public Collection<LogicMethod> getLogics()
50: throws LogicNotFoundException {
51: Collection<LogicMethod> original = type.getLogics();
52: Collection<LogicMethod> overriden = new ArrayList<LogicMethod>();
53: // returns the wrapped logics
54: for (LogicMethod method : original) {
55: overriden.add(getLogic(method.getName()));
56: }
57: return overriden;
58: }
59:
60: public Class getComponentClass() {
61: return type.getComponentClass();
62: }
63:
64: public ScopeType getScope() {
65: return type.getScope();
66: }
67:
68: public String getKey() {
69: return type.getKey();
70: }
71:
72: public String getDestroyLogicName() {
73: return type.getDestroyLogicName();
74: }
75:
76: public Map<String, Object> getOutjectedValues(Object comp,
77: ScopeType scope) throws GettingException,
78: MethodInvocationException {
79: return type.getOutjectedValues(comp, scope);
80: }
81:
82: public BeanConstructor getConstructor() {
83: return type.getConstructor();
84: }
85:
86: }
|