private void generateDaoPart ( M2MEntity entity ) { String daoClassName = entity . daoName . simpleName ( ) ; String daoPackageName = entity . daoName . packageName ( ) ; String entityPackageName = entity . getPackageName ( ) ; String generatedDaoClassName = "Generated" + daoClassName ; AnnotationProcessorUtilis . infoOnGeneratedClasses ( BindDaoMany2Many . class , daoPackageName , generatedDaoClassName ) ; // @formatter:off classBuilder = TypeSpec . interfaceBuilder ( generatedDaoClassName ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( AnnotationSpec . builder ( BindDao . class ) . addMember ( "value" , "$T.class" , TypeUtility . className ( entityPackageName , entity . name ) ) . build ( ) ) . addAnnotation ( AnnotationSpec . builder ( BindGeneratedDao . class ) . addMember ( "dao" , "$T.class" , entity . daoName ) . build ( ) ) . addAnnotation ( AnnotationSpec . builder ( BindDaoMany2Many . class ) . addMember ( "entity1" , "$T.class" , entity . entity1Name ) . addMember ( "entity2" , "$T.class" , entity . entity2Name ) . build ( ) ) . addSuperinterface ( entity . daoName ) ; // @formatter:on JavadocUtility . generateJavadocGeneratedBy ( classBuilder ) ; if ( entity . generateMethods ) { generateSelects ( entity , entityPackageName ) ; generateDeletes ( entity , entityPackageName ) ; generateInsert ( entity , entityPackageName ) ; } TypeSpec typeSpec = classBuilder . build ( ) ; try { JavaWriterHelper . writeJava2File ( filer , daoPackageName , typeSpec ) ; } catch ( IOException e ) { throw new KriptonRuntimeException ( e ) ; } GeneratedTypeElement daoPartElement = new GeneratedTypeElement ( daoPackageName , classBuilder . build ( ) , null , null ) ; daoResult . add ( daoPartElement ) ; }
Generate dao part .