private void fillMethods ( final SQLiteDaoDefinition currentDaoDefinition , Element daoElement ) { final One < Boolean > methodWithAnnotation = new One < Boolean > ( false ) ; // create method for dao SqlBuilderHelper . forEachMethods ( ( TypeElement ) daoElement , new MethodFoundListener ( ) { @ Override public void onMethod ( ExecutableElement element ) { if ( excludedMethods . contains ( element . getSimpleName ( ) . toString ( ) ) ) return ; methodWithAnnotation . value0 = false ; final List < ModelAnnotation > annotationList = new ArrayList <> ( ) ; // optional annotations final List < ModelAnnotation > supportAnnotationList = new ArrayList <> ( ) ; AnnotationUtility . forEachAnnotations ( element , new AnnotationFoundListener ( ) { @ Override public void onAcceptAnnotation ( Element element , String annotationClassName , Map < String , String > attributes ) { if // @formatter:off ( annotationClassName . equals ( BindSqlInsert . class . getCanonicalName ( ) ) || annotationClassName . equals ( BindSqlUpdate . class . getCanonicalName ( ) ) || annotationClassName . equals ( BindSqlDelete . class . getCanonicalName ( ) ) || annotationClassName . equals ( BindSqlSelect . class . getCanonicalName ( ) ) || annotationClassName . equals ( BindContentProviderEntry . class . getCanonicalName ( ) ) ) // @formatter:on { if ( ! annotationClassName . equals ( BindContentProviderEntry . class . getCanonicalName ( ) ) ) { methodWithAnnotation . value0 = true ; } ModelAnnotation annotation = new ModelAnnotation ( annotationClassName , attributes ) ; annotationList . add ( annotation ) ; } // we don't insert annotation } } ) ; annotationList . addAll ( supportAnnotationList ) ; final SQLiteModelMethod currentMethod = new SQLiteModelMethod ( currentDaoDefinition , element , annotationList ) ; AssertKripton . assertTrueOrInvalidMethodSignException ( methodWithAnnotation . value0 , currentMethod , "method must be annotated with @%s, @%s, @%s or @%s" , BindSqlSelect . class . getSimpleName ( ) , BindSqlInsert . class . getSimpleName ( ) , BindSqlUpdate . class . getSimpleName ( ) , BindSqlDelete . class . getSimpleName ( ) ) ; // annotated", currentDaoDefinition.getName(), // element.getSimpleName()); addWithCheckMethod ( currentDaoDefinition , currentMethod ) ; } private void addWithCheckMethod ( SQLiteDaoDefinition currentDaoDefinition , SQLiteModelMethod newMethod ) { SQLiteModelMethod oldMethod = currentDaoDefinition . findPropertyByName ( newMethod . getName ( ) ) ; // ASSERT: same name and same number if ( oldMethod != null && oldMethod . getParameters ( ) . size ( ) == newMethod . getParameters ( ) . size ( ) ) { boolean sameParameters = true ; for ( int i = 0 ; i < oldMethod . getParameters ( ) . size ( ) ; i ++ ) { if ( ! oldMethod . getParameters ( ) . get ( i ) . value1 . equals ( newMethod . getParameters ( ) . get ( i ) . value1 ) ) { sameParameters = false ; break ; } } AssertKripton . failWithInvalidMethodSignException ( sameParameters , newMethod , "conflict between generated method and declared method." ) ; } // add method currentDaoDefinition . add ( newMethod ) ; } } ) ; }
Fill methods .