private void generateConcreteMethods ( Map interfaceMethods ) { if ( interfaceMethods == null ) return ; Iterator it = interfaceMethods . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { CtMethod interfaceMethod = ( CtMethod ) it . next ( ) ; if ( interfaceMethod != null //&& isBaseInterfaceMethod(interfaceMethod.getName())) && ( interfaceMethod . getDeclaringClass ( ) . getName ( ) . equals ( javax . slee . ActivityContextInterface . class . getName ( ) ) || interfaceMethod . getDeclaringClass ( ) . getName ( ) . equals ( ActivityContextInterfaceExt . class . getName ( ) ) ) ) continue ; // @todo: need to check args also try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod . copy ( interfaceMethod , concreteActivityContextInterface , null ) ; // create the method body String fieldName = interfaceMethod . getName ( ) . substring ( 3 ) ; fieldName = fieldName . substring ( 0 , 1 ) . toLowerCase ( ) + fieldName . substring ( 1 ) ; String concreteMethodBody = null ; if ( interfaceMethod . getName ( ) . startsWith ( "get" ) ) { concreteMethodBody = "{ return ($r)getFieldValue(\"" + fieldName + "\"," + concreteMethod . getReturnType ( ) . getName ( ) + ".class); }" ; } else if ( interfaceMethod . getName ( ) . startsWith ( "set" ) ) { concreteMethodBody = "{ setFieldValue(\"" + fieldName + "\",$1); }" ; } else { throw new SLEEException ( "unexpected method name <" + interfaceMethod . getName ( ) + "> to implement in sbb aci interface" ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + interfaceMethod . getName ( ) + " , body = " + concreteMethodBody ) ; } concreteMethod . setBody ( concreteMethodBody ) ; concreteActivityContextInterface . addMethod ( concreteMethod ) ; } catch ( Exception cce ) { throw new SLEEException ( "Cannot compile method " + interfaceMethod . getName ( ) , cce ) ; } } }
Generates the concrete methods of the class It generates a specific method implementation for the javax . slee . ActivityContextInterface methods for the methods coming from the ActivityContextInterface developer the call is routed to the base asbtract class