1 package org.andromda.metafacades.emf.uml22;
2
3 import java.util.Collection;
4 import java.util.TreeSet;
5 import org.andromda.metafacades.uml.GeneralizableElementFacade;
6 import org.andromda.metafacades.uml.StereotypeFacade;
7
8
9
10
11
12
13 public class ValueObjectLogicImpl
14 extends ValueObjectLogic
15 {
16 private static final long serialVersionUID = 34L;
17
18
19
20
21 public ValueObjectLogicImpl(
22 final Object metaObject,
23 final String context)
24 {
25 super(metaObject, context);
26 }
27
28
29
30
31
32
33 @Override
34 protected Collection<ValueObjectLogic> handleGetTypeSpecializations()
35 {
36 final StringBuilder stereotypes = new StringBuilder();
37 for (StereotypeFacade stereotype : this.getStereotypes())
38 {
39 stereotypes.append(stereotype.getName()).append(',');
40 }
41 return this.handleGetTypeSpecializations(stereotypes.toString());
42 }
43
44
45
46
47
48 protected Collection<ValueObjectLogic> handleGetTypeSpecializations(final String stereotypes)
49 {
50 final Collection<ValueObjectLogic> specializations = new TreeSet<ValueObjectLogic>();
51 final String[] stereotypeList = stereotypes.split(",", -1);
52 for (GeneralizableElementFacade classifier : this.getAllSpecializations())
53 {
54 if (classifier instanceof ValueObjectLogic)
55 {
56 for (int i=0; i<stereotypeList.length; i++)
57 {
58 if (classifier.hasStereotype(stereotypeList[i]) && !specializations.contains(classifier))
59 {
60 specializations.add((ValueObjectLogic) classifier);
61 }
62 }
63 }
64 }
65 return specializations;
66 }
67 }