I hope you are using AndroMDA 2.x (if not just ignore my post):

1. Add this method in your "Transform" class:

    /**
     * Gets a complete class with its inheritance/generalization,
     * if it provides the super class.
     *
     * Example: "Student extends Person"
     *          "Student"
     *
     * @param object a model element
     * @return the complete class name
     */
    public String getClassNameWithGeneralization(Object object) {
        // Get this class first
        Classifier thisClass = (Classifier) object;
        // Put the name alltogether
        String className = thisClass.getName();

        // Get the superclass
        GeneralizableElement generalization = getGeneralization(object);

        if (generalization != null) {
            // The superclass is a class, do whatever you want
            // with it...
            Classifier superClass = (Classifier) generalization;

            // Get the super class with full package name
            String superClassName = getFullyQualifiedName(superClass);

            return className + " extends " + superClassName;
        }
        else {
            return className;
        }
    }

2. Use the above method in your template (I prefer to write a long
Java code and a short Velocity method ;-)

#set ($classNameWithGeneralization =
  $transform.getClassNameWithGeneralization($class))
public interface ${classNameWithGeneralization} {

Hope this helps!
--
---------------------------------------------------
Blasius Lofi Dewanto
---------------------------------------------------
OpenUSS - Open University Support System
http://openuss.sourceforge.net
---------------------------------------------------
E-Mail   : [EMAIL PROTECTED]
ICQ      : 39343280
---------------------------------------------------

Gerwin Brunner schrieb:
> Hi!
>
> I'm running into the same problem.
>
> Here's my code:
>
> #set ($generalization = $transform.getGeneralization($class.id))
> #if (!${generalization})
> #set ($extendtag = "")
> #else
> #set ($parentClassName = ${generalization.getName()})
> #set ($parentClassNamePackage = $transform.findPackageName($generalization))
> #set ($parentClassFullName = $transform.findFullyQualifiedName($generalization))
> #set ($extendtag = "extends $parentClassName ")
> #if ( $packagename != $parentClassNamePackage )
>
> #foreach ($att in $generalization.getAttributes() )
> #set ($atttypename = $transform.findFullyQualifiedName($att.type))
> /***************************************
> * CastorDoclet
> * @sql-size $transform.findAttributeSQLFieldLength($att)
> ************************************** */
> private $atttypename ${att.name};
> #end
>
> The "import" clause works, but the attributes are not found!
> Is there a solution yet?
>
> Gerwin*
>
>
>
>>I can't get the attributes from a super class. I have tried this:
>>
>>#set ($superclass =
>>$transform.getGeneralization($transform.findClassById($class.id)))
>>
>>#foreach ( $att in $superclass.attributes)
>> ...
>>#end
>>
>>But the attributes are not found. Someone said that you get the
>>Generalization object from getGeneralization so I also tried this:
>>
>>#set ($gen =
>>$transform.getGeneralization($transform.findClassById($class.id)))
>>#set ($superclass = $gen.parent)
>>
>>
>>#foreach ( $att in $superclass.attributes)
>> ...
>>#end
>>
>>
>>But here superclass is nothing.
>>
>>
>>Any suggestions?
>>
>>// Johan
>>
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g.
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id149&alloc_id?66&op=click
> _______________________________________________
> Andromda-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/andromda-user
>
>






-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to