[Uml-devel] [Bug 72042] code generation ignores unidirectional association

Antoine Dopffer adopffer at nerdshack.com
Sat Feb 24 00:08:06 UTC 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=72042         




------- Additional Comments From adopffer nerdshack com  2007-02-24 01:08 -------
Created an attachment (id=19795)
 --> (http://bugs.kde.org/attachment.cgi?id=19795&action=view)
class diagram with unidirectional association 

With the patch submited further and this class diagram, the C++ generated code
is:
---------------------------------------------------
......
#ifndef CLASS1_H
#define CLASS1_H

#include <string>
#include <vector>

class Class2;


/**
  * class Class1
  */

class Class1
{
public:

  // Constructors/Destructors
  //  


  /**
   * Empty Constructor
   */
  Class1 ( );

  /**
   * Empty Destructor
   */
  virtual ~Class1 ( );

  // Static public attributes
  //  

  // public attributes
  //  


  Class2 * m_rolea;

  // public attribute accessor methods
  //  


  // public attribute accessor methods
  //  

  /**
   * Set the value of m_rolea
   *  param new_var the new value of m_rolea
   */
  void setroleA ( Class2 * new_var );

  /**
   * Get the value of m_rolea
   *  return the value of m_rolea
   */
  Class2 * getroleA ( );
protected:
  // Static protected attributes
  //  
  // protected attributes
  //  
public:
  // protected attribute accessor methods
  //  
protected:
public:
  // protected attribute accessor methods
  //  
protected:
private:
  // Static private attributes
  //  
  // private attributes
  //  
public:
  // private attribute accessor methods
  //  
private:
public:
  // private attribute accessor methods
  //  
private:
};

#endif // CLASS1_H
--------------------------------------------------------------
the Java generated code is:
--------------------------------------------------------------
import java.util.*;


/**
 * Class Class1
 */
public class Class1 {

  //
  // Fields
  //


  public Class2 m_roleA;
  
  //
  // Constructors
  //
  public Class1 () { };
  
  //
  // Methods
  //


  //
  // Accessor methods
  //

  /**
   * Set the value of m_roleA
   *  param newVar the new value of m_roleA
   */
  public void setRoleA ( Class2 newVar ) {
    m_roleA = newVar;
  }

  /**
   * Get the value of m_roleA
   *  return the value of m_roleA
   */
  public Class2 getRoleA ( ) {
    return m_roleA;
  }

  //
  // Other methods
  //

}




More information about the umbrello-devel mailing list