01: package org.andromda.metafacades.emf.uml2;
02:
03: import org.apache.commons.lang.StringUtils;
04:
05: /**
06: * MetafacadeLogic implementation for
07: * org.andromda.metafacades.uml.DependencyFacade.
08: *
09: * @see org.andromda.metafacades.uml.DependencyFacade
10: */
11: public class DependencyFacadeLogicImpl extends DependencyFacadeLogic {
12: public DependencyFacadeLogicImpl(
13: final org.eclipse.uml2.DirectedRelationship metaObject,
14: final String context) {
15: super (metaObject, context);
16: }
17:
18: /**
19: * Gets the name in the following manner.
20: * <ol>
21: * <li>If the dependency has a name return it.</li>
22: * <li>If the dependency does <strong>NOT </strong> have a name, get the
23: * target element's and return its name uncapitalized.</li>
24: * </ol>
25: *
26: * @see org.andromda.metafacades.uml.ModelElementFacade#getName()
27: */
28: public String handleGetName() {
29: String name = super .handleGetName();
30: if (StringUtils.isBlank(name)
31: && this .getTargetElement() != null) {
32: name = StringUtils.uncapitalize(this .getTargetElement()
33: .getName());
34: }
35: return name;
36: }
37:
38: /**
39: * @see org.andromda.metafacades.uml.DependencyFacade#getGetterName()
40: */
41: protected java.lang.String handleGetGetterName() {
42: return "get" + StringUtils.capitalize(this .getName());
43: }
44:
45: /**
46: * @see org.andromda.metafacades.uml.DependencyFacade#getSetterName()
47: */
48: protected java.lang.String handleGetSetterName() {
49: return "set" + StringUtils.capitalize(this .getName());
50: }
51:
52: /**
53: * @see org.andromda.metafacades.uml.DependencyFacade#getTargetElement()
54: */
55: protected java.lang.Object handleGetTargetElement() {
56: return UmlUtilities.ELEMENT_TRANSFORMER
57: .transform(this .metaObject.getTargets().toArray()[0]);
58: }
59:
60: /**
61: * @see org.andromda.metafacades.uml.DependencyFacade#getSourceElement()
62: */
63: protected java.lang.Object handleGetSourceElement() {
64: return UmlUtilities.ELEMENT_TRANSFORMER
65: .transform(this .metaObject.getSources().toArray()[0]);
66: }
67: }
|