Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emf-dev] Using custom EList implementation

Mikhail,

Please use the newsgroup to ask questions rather than the mailing list.

To do what you want, you'd need to use dynamic templates:

   http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_Dynamic_Templates.3F

This is the part you'd need to change:

      public <%=genFeature.getImportedType(genClass)%> <%=genFeature.
getGetAccessor()%>()
      {
<%@ include file="Class/getGenFeature.pre.insert.javajetinc" fail="silent"
%>
    <%if (genModel.isReflectiveDelegation()) {%>
            return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=
genFeature.getObjectType(genClass)%>)eGet(<%=
genFeature.getQualifiedFeatureAccessor()%>, true)<%if
(genFeature.isPrimitiveType()) {%>).<%=
genFeature.getPrimitiveValueFunction()%>()<%}%>;
    <%} else if (!genFeature.isVolatile()) {%>
      <%if (genFeature.isListType()) {%>
        <%if (genModel.isVirtualDelegation()) {%>
            <%=genFeature.getImportedType(genClass)%> <%=
genFeature.getSafeName()%> = (<%=genFeature.getImportedType(genClass)%>
)eVirtualGet(<%=genClass.getQualifiedFeatureID(genFeature)%><%=
positiveOffsetCorrection%>);
        <%}%>
            if (<%=genFeature.getSafeName()%> == null)
            {
        <%if (genModel.isVirtualDelegation()) {%>
                  eVirtualSet(<%=genClass.getQualifiedFeatureID(genFeature)
%><%=positiveOffsetCorrection%>, <%=genFeature.getSafeName()%> = new <%=
genClass.getListConstructor(genFeature)%>);
        <%} else {%>
                  <%=genFeature.getSafeName()%> = new <%=
genClass.getListConstructor(genFeature)%>;
        <%}%>
            }


Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 313)




                                                                       
             "Sennikovsky,                                             
             Mikhail"                                                  
             <mikhail.sennikov                                          To
             sky@xxxxxxxxx>            <emf-dev@xxxxxxxxxxx>           
             Sent by:                                                   cc
             emf-dev-bounces@e                                         
             clipse.org                                            Subject
                                       [emf-dev] Using custom EList    
                                       implementation                  
             12/07/2007 08:28                                          
             AM                                                        
                                                                       
                                                                       
             Please respond to                                         
             Eclipse Modelling                                         
                 Framework                                             
             <emf-dev@eclipse.                                         
                   org>                                                
                                                                       
                                                                       




Hi all,

I have a question on generation of implementation classes for EMF-based
model. Is there any way that I could make the generated Impl classes to use
my own custom EList implementation? E.g. could I make the generated EList
getFoo() method listed below to use/create/return my own EList
implementation instead of the ?default? one?

public EList getFoo() {
      if (foo == null) {
//could I make the generator to generate
            foo = new MyOwnEListImplementation(...);
//instead of the ?default? EList implementation, e.g.
            foo = new EObjectResolvingEList(...);
      }
      return foo;
}

Thanks,
Mikhail



--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: 125252, Moscow, Russian Federation,
Chapayevsky Per, 14.

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
emf-dev mailing list
emf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/emf-dev






Back to the top