1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.ValueObject;
11 import org.apache.log4j.Logger;
12 import org.omg.uml.foundation.core.Classifier;
13
14
15
16
17
18
19
20 public abstract class ValueObjectLogic
21 extends ClassifierFacadeLogicImpl
22 implements ValueObject
23 {
24
25
26
27
28 protected Object metaObject;
29
30
31
32
33
34 protected ValueObjectLogic(Object metaObjectIn, String context)
35 {
36 super((Classifier)metaObjectIn, getContext(context));
37 this.metaObject = metaObjectIn;
38 }
39
40
41
42
43 private static final Logger logger = Logger.getLogger(ValueObjectLogic.class);
44
45
46
47
48
49
50 private static String getContext(String context)
51 {
52 if (context == null)
53 {
54 context = "org.andromda.metafacades.uml.ValueObject";
55 }
56 return context;
57 }
58
59
60
61
62 @Override
63 public void resetMetafacadeContext(String context)
64 {
65 if (!this.contextRoot)
66 {
67 context = getContext(context);
68 setMetafacadeContext (context);
69 }
70 }
71
72
73
74
75
76 public boolean isValueObjectMetaType()
77 {
78 return true;
79 }
80
81
82
83 private Collection<ValueObject> __getTypeSpecializations1r;
84 private boolean __getTypeSpecializations1rSet = false;
85
86
87
88
89
90
91 public final Collection<ValueObject> getTypeSpecializations()
92 {
93 Collection<ValueObject> getTypeSpecializations1r = this.__getTypeSpecializations1r;
94 if (!this.__getTypeSpecializations1rSet)
95 {
96
97 Collection result = handleGetTypeSpecializations();
98 List shieldedResult = this.shieldedElements(result);
99 try
100 {
101 getTypeSpecializations1r = (Collection<ValueObject>)shieldedResult;
102 }
103 catch (ClassCastException ex)
104 {
105
106 ValueObjectLogic.logger.warn("incorrect metafacade cast for ValueObjectLogic.getTypeSpecializations Collection<ValueObject> " + result + ": " + shieldedResult);
107 }
108
109 this.__getTypeSpecializations1r = getTypeSpecializations1r;
110 if (isMetafacadePropertyCachingEnabled())
111 {
112 this.__getTypeSpecializations1rSet = true;
113 }
114 }
115 return getTypeSpecializations1r;
116 }
117
118
119
120
121
122 protected abstract Collection handleGetTypeSpecializations();
123
124
125
126
127
128 @Override
129 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
130 {
131 super.validateInvariants(validationMessages);
132 }
133 }