public void insertConstructor ( InsertableConstructor insertableConstructor ) throws CannotCompileException , AfterBurnerImpossibleException , NotFoundException { // create or complete onViewCreated List < CtConstructor > constructorList = extractExistingConstructors ( insertableConstructor ) ; log . info ( "constructor : " + constructorList . toString ( ) ) ; if ( ! constructorList . isEmpty ( ) ) { for ( CtConstructor constructor : constructorList ) { constructor . insertBeforeBody ( insertableConstructor . getConstructorBody ( constructor . getParameterTypes ( ) ) ) ; } } else { throw new AfterBurnerImpossibleException ( "No suitable constructor was found in class " + insertableConstructor . getClassToInsertInto ( ) . getName ( ) + ". Add a constructor that is accepted by the InsertableConstructor. Don't use non static inner classes." ) ; } }
Inserts java instructions into all constructors a given class .