View Javadoc

1   package org.andromda.core.simpleuml;
2   
3   import org.andromda.core.uml14.UMLStaticHelper;
4   import org.omg.uml.foundation.core.AssociationEnd;
5   import org.omg.uml.foundation.core.Classifier;
6   
7   /***
8    * dynamic proxy for an AssociationEnd: dynamically supports the UMLAssociationEnd, 
9    * and org.omg.uml.foundation.core.AssociationEnd interfaces.
10   * 
11   * @author <A HREF="http://www.amowers.com">Anthony Mowers</A>
12   */
13  public class PAssociationEnd
14  	extends PModelElement
15  	implements UMLAssociationEnd
16  {
17  	public static AssociationEnd newInstance(
18  		UMLStaticHelper scriptHelper,
19  		AssociationEnd associationEnd)
20  	{
21  		Class[] interfaces = {
22  			UMLAssociationEnd.class,
23  			AssociationEnd.class
24  		};
25  		
26  		return (AssociationEnd)java.lang.reflect.Proxy.newProxyInstance(
27  			associationEnd.getClass().getClassLoader(),
28  			interfaces,
29  			new PAssociationEnd(associationEnd, scriptHelper));
30  	}
31  
32  
33  	
34  	protected PAssociationEnd(
35  		AssociationEnd associationEnd,
36  		UMLStaticHelper scriptHelper)
37  	{
38  		super(associationEnd,scriptHelper);
39  	}
40  	
41  	public String getRoleName()
42  	{
43  		String roleName = modelElement.getName();
44  		if ( (roleName == null) || (roleName.length() == 0) )
45  		{
46  			AssociationEnd ae = (AssociationEnd)modelElement;
47  			roleName = "The" + ae.getParticipant().getName();
48  		}
49  		
50  		return roleName;
51  	}
52  	
53  	public Classifier getType()
54  	{
55  		AssociationEnd ae = (AssociationEnd)modelElement;
56  		
57  		return PClassifier.newInstance(
58  			scriptHelper, ae.getParticipant());
59  	}
60  	
61  	public Object getId()
62  	{
63  		return modelElement.refMofId();
64  	}
65  	
66  	public String getNavigable()
67  	{
68  		AssociationEnd ae = (AssociationEnd)modelElement;
69  		
70  		return ae.isNavigable() ? "true" : "false";
71  	}
72  }