idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
4,400
public static String generateEntityName ( SQLiteDaoDefinition dao , SQLiteEntity entity ) { String entityName ; if ( entity == null ) { M2MEntity m2mEntity = M2MEntity . extractEntityManagedByDAO ( dao . getElement ( ) ) ; entityName = m2mEntity . getSimpleName ( ) ; } else { entityName = entity . getSimpleName ( ) ; }...
dao or entity can be null .
4,401
public static String generateEntityQualifiedName ( SQLiteDaoDefinition dao , SQLiteEntity entity ) { String entityName ; if ( entity == null ) { M2MEntity m2mEntity = M2MEntity . extractEntityManagedByDAO ( dao . getElement ( ) ) ; entityName = m2mEntity . getQualifiedName ( ) ; } else { entityName = entity . getName (...
Generate entity qualified name .
4,402
public static void generate ( Elements elementUtils , Filer filer , SQLiteDatabaseSchema schema ) throws Exception { BindContentProviderBuilder visitorDao = new BindContentProviderBuilder ( elementUtils , filer , schema ) ; visitorDao . build ( elementUtils , filer , schema ) ; }
Generate content provider .
4,403
private void generateURIForMethod ( SQLiteDatabaseSchema schema , List < FieldSpec > listFieldAlias , Set < String > alreadyUsedName , Converter < String , String > format , Pair < String , ContentEntry > entry , SQLiteModelMethod method ) { if ( method == null ) return ; String alias = "URI_" + entry . value1 . pathCo...
Generate URI for method .
4,404
private void defineJavadocForContentUri ( MethodSpec . Builder builder , SQLiteModelMethod method ) { String contentUri = method . contentProviderUri ( ) . replace ( "*" , "[*]" ) ; classBuilder . addJavadoc ( "<tr><td><pre>$L</pre></td><td>{@link $LImpl#$L}</td></tr>\n" , contentUri , method . getParent ( ) . getName ...
Define javadoc for content uri .
4,405
private void generateDelete ( SQLiteDatabaseSchema schema ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "delete" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( Integer . TYPE ) ; methodBuilder . addParameter ( Uri . class , "uri" ) ; methodBuilder . addPa...
Generate delete .
4,406
private void defineJavadocHeaderForContentOperation ( MethodSpec . Builder builder , String value ) { builder . addJavadoc ( "\n<h2>Supported $L operations</h2>\n" , value ) ; builder . addJavadoc ( "<table>\n" ) ; builder . addJavadoc ( "<tr><th>URI</th><th>DAO.METHOD</th></tr>\n" ) ; classBuilder . addJavadoc ( "<h2>...
Define javadoc header for content operation .
4,407
private void generateGetType ( SQLiteDatabaseSchema schema ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "getType" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( String . class ) ; methodBuilder . addParameter ( Uri . class , "uri" ) ; methodBuilder . beg...
Generate get type .
4,408
private void generateOnShutdown ( String dataSourceNameClazz ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "shutdown" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( Void . TYPE ) ; methodBuilder . addJavadoc ( "<p>Close database.</p>\n" ) ; methodBuilder ...
Generate on shutdown .
4,409
private void generateQuery ( SQLiteDatabaseSchema schema ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "query" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( Cursor . class ) ; methodBuilder . addParameter ( Uri . class , "uri" ) ; methodBuilder . addPara...
Generate query .
4,410
public static void generateImmutableCollectionIfPossible ( ModelClass < ? > entity , Builder methodBuilder , String name , TypeName typeName ) { if ( TypeUtility . isList ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( List . class ) ) ) { methodBuilder . addCode ( "($L==nu...
used for example for dao select result
4,411
public T get ( int index ) { T item = mStorage . get ( index ) ; if ( item != null ) { mLastItem = item ; } return item ; }
Get the item in the list of loaded items at the provided index .
4,412
public void loadAround ( int index ) { mLastLoad = index + getPositionOffset ( ) ; loadAroundInternal ( index ) ; mLowestIndexAccessed = Math . min ( mLowestIndexAccessed , index ) ; mHighestIndexAccessed = Math . max ( mHighestIndexAccessed , index ) ; tryDispatchBoundaryCallbacks ( true ) ; }
Load adjacent items to passed index .
4,413
void deferBoundaryCallbacks ( final boolean deferEmpty , final boolean deferBegin , final boolean deferEnd ) { if ( mBoundaryCallback == null ) { throw new IllegalStateException ( "Can't defer BoundaryCallback, no instance" ) ; } if ( mLowestIndexAccessed == Integer . MAX_VALUE ) { mLowestIndexAccessed = mStorage . siz...
Safe to access main thread only state - no other thread has reference during construction
4,414
void resolveTypeVariable ( SQLiteModelMethod value ) { for ( Pair < String , TypeName > item : value . getParameters ( ) ) { item . value1 = typeVariableResolver . resolve ( item . value1 ) ; } value . setReturnClass ( typeVariableResolver . resolve ( value . getReturnClass ( ) ) ) ; }
Convert type variable in correct type . This must be done before work on SQLMethod
4,415
String buildPreparedStatementName ( String methodName ) { String name = methodName + "PreparedStatement" + preparedStatementNames . size ( ) ; preparedStatementNames . add ( name ) ; return name ; }
Build and register prepared statement name .
4,416
public String generateJava2ContentSerializer ( TypeName paramTypeName ) { if ( ! managedParams . containsKey ( paramTypeName ) ) { managedParams . put ( paramTypeName , "" + ( managedParams . size ( ) + 1 ) ) ; } return PARAM_SERIALIZER_PREFIX + managedParams . get ( paramTypeName ) ; }
Generate java 2 content serializer .
4,417
public String generateJava2ContentParser ( TypeName paramTypeName ) { if ( ! managedParams . containsKey ( paramTypeName ) ) { managedParams . put ( paramTypeName , "" + ( managedParams . size ( ) + 1 ) ) ; } return PARAM_PARSER_PREFIX + managedParams . get ( paramTypeName ) ; }
Generate java 2 content parser .
4,418
public boolean hasSamePackageOfSchema ( ) { String packageName = getPackageName ( ) ; String schemaPackageName = getParent ( ) . getPackageName ( ) ; return packageName . equals ( schemaPackageName ) ; }
Returns true if dao and schema stay in same package
4,419
public static void generateSubjectNext ( SQLiteEntity entity , MethodSpec . Builder methodBuilder , SubjectType subjectType , String value ) { String subInsertType = "" ; if ( subjectType == SubjectType . INSERT ) { if ( entity . getPrimaryKey ( ) . isType ( String . class ) ) { subInsertType = "WithUid" ; } else { sub...
Generate subject next .
4,420
public static Boolean readBoolean ( String value , Boolean defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Boolean . valueOf ( value ) ; }
Read boolean .
4,421
public static Byte readByte ( String value , Byte defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Byte . valueOf ( value ) ; }
Read byte .
4,422
public static Character readCharacter ( String value , Character defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Character . valueOf ( ( char ) Integer . parseInt ( value ) ) ; }
Read character .
4,423
public static Short readShort ( String value , Short defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Short . valueOf ( value ) ; }
Read short .
4,424
public static Integer readInteger ( String value , Integer defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Integer . valueOf ( value ) ; }
Read integer .
4,425
public static Long readLong ( String value , Long defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Long . valueOf ( value ) ; }
Read long .
4,426
public static Float readFloat ( String value , Float defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Float . valueOf ( value ) ; }
Read float .
4,427
public static Double readDouble ( String value , Double defaultValue ) { if ( ! StringUtils . hasText ( value ) ) return defaultValue ; return Double . valueOf ( value ) ; }
Read double .
4,428
public static String writeBoolean ( Boolean value ) { if ( value == null ) return null ; return Boolean . toString ( value ) ; }
Write boolean .
4,429
public static String writeCharacter ( Character value ) { if ( value == null ) return null ; return Integer . toString ( ( int ) value ) ; }
Write character .
4,430
public static String writeShort ( Short value ) { if ( value == null ) return null ; return Short . toString ( value ) ; }
Write short .
4,431
public static String writeInteger ( Integer value ) { if ( value == null ) return null ; return Integer . toString ( value ) ; }
Write integer .
4,432
public static String writeLong ( Long value ) { if ( value == null ) return null ; return Long . toString ( value ) ; }
Write long .
4,433
public static String writeFloat ( Float value ) { if ( value == null ) return null ; return Float . toString ( value ) ; }
Write float .
4,434
public static String writeDouble ( Double value ) { if ( value == null ) return null ; return Double . toString ( value ) ; }
Write double .
4,435
protected List < SQLiteUpdateTask > buildTaskList ( int previousVersion , int currentVersion ) { List < SQLiteUpdateTask > result = new ArrayList < > ( ) ; for ( Pair < Integer , ? extends SQLiteUpdateTask > item : this . options . updateTasks ) { if ( item . value0 - 1 == previousVersion ) { result . add ( item . valu...
Builds the task list .
4,436
protected void createHelper ( DataSourceOptions options ) { if ( KriptonLibrary . getContext ( ) == null ) throw new KriptonRuntimeException ( "Kripton library is not properly initialized. Please use KriptonLibrary.init(context) somewhere at application startup" ) ; if ( options . inMemory ) { Logger . info ( "In-memor...
Creates the helper .
4,437
public void onDowngrade ( SQLiteDatabase db , int oldVersion , int newVersion ) { if ( AbstractDataSource . this . options . databaseLifecycleHandler != null ) { AbstractDataSource . this . options . databaseLifecycleHandler . onUpdate ( db , oldVersion , newVersion , false ) ; versionChanged = true ; } }
On downgrade .
4,438
public void onUpgrade ( SQLiteDatabase db , int oldVersion , int newVersion ) { if ( AbstractDataSource . this . options . databaseLifecycleHandler != null ) { AbstractDataSource . this . options . databaseLifecycleHandler . onUpdate ( db , oldVersion , newVersion , true ) ; versionChanged = true ; } }
On upgrade .
4,439
public static void assertTrue ( boolean expression , String messageFormat , Object ... args ) { if ( ! expression ) throw ( new KriptonProcessorException ( String . format ( messageFormat , args ) ) ) ; }
Assertion which generate an exception if expression is not true .
4,440
public static void assertTrueOrInvalidMethodSignException ( boolean expression , SQLiteModelMethod method , String messageFormat , Object ... args ) { if ( ! expression ) throw ( new InvalidMethodSignException ( method , String . format ( messageFormat , args ) ) ) ; }
Assert true or invalid method sign exception .
4,441
public static void failWithInvalidMethodSignException ( boolean expression , SQLiteModelMethod method , String messageFormat , Object ... args ) { assertTrueOrInvalidMethodSignException ( ! expression , method , messageFormat , args ) ; }
if expression is true it fails . It is the opposite of assert
4,442
public static void failIncompatibleAttributesInAnnotationException ( String messageFormat , Object ... args ) { throw ( new IncompatibleAttributesInAnnotationException ( String . format ( messageFormat , args ) ) ) ; }
Fail incompatible attributes in annotation exception .
4,443
public static void fail ( boolean expression , String messageFormat , Object ... args ) { assertTrue ( ! expression , messageFormat , args ) ; }
Fails if expression is true .
4,444
public static void assertTrueOrInvalidKindForAnnotationException ( boolean expression , Element element , Class < ? extends Annotation > annotationClazz ) { if ( ! expression ) { String msg = String . format ( "%s %s, only class can be annotated with @%s annotation" , element . getKind ( ) , element , annotationClazz ....
Assert true or invalid kind for annotation exception .
4,445
public static void assertTrueOrInvalidTypeForAnnotationMethodParameterException ( boolean expression , Element classElement , ExecutableElement methodElement , VariableElement parameterElement , Class < ? extends Annotation > annotationClazz ) { if ( ! expression ) { String msg = String . format ( "In method '%s.%s', p...
In case a method s parameters is of a type incompatible with specific annotation .
4,446
public static void assertTrueOrUnknownPropertyInJQLException ( boolean expression , JQLContext method , String columnName ) { if ( ! expression ) { throw ( new UnknownPropertyInJQLException ( method , columnName ) ) ; } }
Assert true or unknown property in JQL exception .
4,447
public static void assertTrueOrUnknownClassInJQLException ( boolean expression , SQLiteModelMethod method , String className ) { if ( ! expression ) { throw ( new UnknownClassInJQLException ( method , className ) ) ; } }
Assert true or unknown class in JQL exception .
4,448
public static void assertTrueOrUnknownParamInJQLException ( boolean expression , SQLiteModelMethod method , String paramName ) { if ( ! expression ) { throw ( new UnknownParamUsedInJQLException ( method , paramName ) ) ; } }
Assert true or unknown param in JQL exception .
4,449
public static void failUnknownPropertyInJQLException ( SQLiteModelMethod method , Class < ? extends Annotation > annotationClazz , AnnotationAttributeType attribute , String fieldName ) { throw ( new UnknownPropertyInJQLException ( method , annotationClazz , attribute , fieldName ) ) ; }
Fail unknown property in JQL exception .
4,450
public static void assertTrueOrInvalidPropertyName ( boolean expression , SQLProperty item1 , SQLProperty item2 ) { if ( ! expression ) { String msg = String . format ( "Properties '%s#%s' and '%s#%s' must have same column name" , item1 . getParent ( ) . name , item1 . name , item2 . getParent ( ) . name , item2 . name...
Assert true or invalid property name .
4,451
public static void asserTrueOrForeignKeyNotFound ( boolean expression , SQLiteEntity currentEntity , ClassName entity ) { if ( ! expression ) { throw ( new ForeignKeyNotFoundException ( currentEntity , entity ) ) ; } }
Asser true or foreign key not found .
4,452
public static void asserTrueOrMissedAnnotationOnClassException ( boolean expression , TypeElement daoElement , String entityName ) { if ( ! expression ) { String msg = String . format ( "Dao '%s' referes a bean '%s' without @%s or @%s annotation" , daoElement . getQualifiedName ( ) , TypeUtility . className ( entityNam...
Asser true or missed annotation on class exception .
4,453
public static void asserTrueOrUnspecifiedBeanException ( boolean expression , SQLiteDatabaseSchema schema , SQLiteEntity entity , String foreignClassName ) { if ( ! expression ) { String msg = String . format ( "In dao definition '%s' is referred a bean definition '%s' that is not defined in '%s' schema" , entity . get...
Asser true or unspecified bean exception .
4,454
public static void assertTrueOfInvalidDefinition ( boolean expression , ModelProperty property , String message ) { if ( ! expression ) { String msg = String . format ( "In class '%s', property '%s' has invalid definition: %s" , property . getParent ( ) . getElement ( ) . asType ( ) . toString ( ) , property . getName ...
Assert true of invalid definition .
4,455
public static void assertTrueOrInvalidGlobalTypeApdaterException ( boolean expression , SQLiteDatabaseSchema sqLiteDatabaseSchema , String typeAdapter , String typeAdapter2 ) { if ( ! expression ) { String msg = String . format ( "In data source '%s', there are two or more global type adapter that cover type '%s': '%s'...
Assert true or invalid global type apdater exception .
4,456
@ SuppressWarnings ( "unchecked" ) static VisitorStatusType visitList ( String name , List < Object > list , BindMapListener listener , VisitorStatusType status ) { int i = 0 ; for ( Object item : list ) { if ( item == null || item instanceof String ) { visit ( name + "." + i , ( String ) item , listener , status ) ; }...
Visit list .
4,457
public static List < SQLProperty > extractUsedProperties ( Builder methodBuilder , SQLiteModelMethod method , Class < ? extends Annotation > annotationClazz ) { SQLiteEntity entity = method . getEntity ( ) ; List < SQLProperty > listPropertyInContentValue = new ArrayList < SQLProperty > ( ) ; Set < String > foundColumn...
Generate code necessary to put bean properties in content values map . Return primary key
4,458
private < L extends UriBaseListener > void analyzePathInternal ( final String input , L listener ) { pathSegmentIndex = - 1 ; walker . walk ( listener , preparePath ( input ) . value0 ) ; }
Analyze path internal .
4,459
public Map < String , ContentUriPlaceHolder > extractAsMap ( String input ) { HashMap < String , ContentUriPlaceHolder > result = new HashMap < > ( ) ; ArrayList < ContentUriPlaceHolder > list = extractPlaceHoldersFromURI ( input , new ArrayList < ContentUriPlaceHolder > ( ) ) ; for ( ContentUriPlaceHolder item : list ...
Extract all parameters from URI as a map .
4,460
public List < ContentUriPlaceHolder > extractFromPath ( String input ) { final List < ContentUriPlaceHolder > result = new ArrayList < > ( ) ; final One < Boolean > valid = new One < > ( ) ; valid . value0 = false ; analyzePathInternal ( input , new UriBaseListener ( ) { public void enterBind_parameter ( Bind_parameter...
Extract from path .
4,461
private < L extends Collection < ContentUriPlaceHolder > > L extractPlaceHoldersFromURI ( String uri , final L result ) { final One < Boolean > valid = new One < > ( ) ; valid . value0 = false ; analyzeInternal ( uri , new UriBaseListener ( ) { public void enterBind_parameter ( Bind_parameterContext ctx ) { result . ad...
Extract place holders from URI .
4,462
private Pair < ParserRuleContext , CommonTokenStream > preparePath ( final String input ) { UriLexer lexer = new UriLexer ( CharStreams . fromString ( input ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; UriParser parser = new UriParser ( tokens ) ; parser . removeErrorListeners ( ) ; parser . addEr...
Prepare path .
4,463
private Pair < ParserRuleContext , CommonTokenStream > prepareUri ( final String input ) { UriLexer lexer = new UriLexer ( CharStreams . fromString ( input ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; UriParser parser = new UriParser ( tokens ) ; parser . removeErrorListeners ( ) ; parser . addErr...
Prepare uri .
4,464
private String replaceInternalFromUri ( String input , final List < Triple < Token , Token , String > > replace , UriBaseListener rewriterListener ) { Pair < ParserRuleContext , CommonTokenStream > parser = prepareUri ( input ) ; pathSegmentIndex = - 1 ; walker . walk ( rewriterListener , parser . value0 ) ; TokenStrea...
Replace internal from uri .
4,465
protected void parseBindType ( RoundEnvironment roundEnv ) { for ( Element item : roundEnv . getElementsAnnotatedWith ( BindType . class ) ) { AssertKripton . assertTrueOrInvalidKindForAnnotationException ( item . getKind ( ) == ElementKind . CLASS , item , BindType . class ) ; globalBeanElements . put ( item . toStrin...
build bindType elements map .
4,466
private static void generateParserOnXmlEndElement ( BindTypeContext context , MethodSpec . Builder methodBuilder , String instanceName , String parserName , BindEntity entity ) { methodBuilder . beginControlFlow ( "if (elementName.equals($L.getName()))" , parserName ) ; methodBuilder . addStatement ( "currentTag = elem...
Generate parser on xml end element .
4,467
private static void generateParseOnXmlAttributes ( BindTypeContext context , MethodSpec . Builder methodBuilder , BindEntity entity ) { BindTransform bindTransform ; int count = 0 ; { for ( BindProperty property : entity . getCollection ( ) ) { if ( property . xmlInfo . xmlType != XmlType . ATTRIBUTE ) continue ; count...
Generate parse on xml attributes .
4,468
private static void generateParserOnXmlStartElement ( BindTypeContext context , MethodSpec . Builder methodBuilder , String instanceName , String parserName , BindEntity entity ) { BindTransform bindTransform ; methodBuilder . addStatement ( "currentTag = xmlParser.getName().toString()" ) ; int count = 0 ; { for ( Bind...
Generate parser on xml start element .
4,469
private static void generateParserOnXmlCharacters ( BindTypeContext context , MethodSpec . Builder methodBuilder , String instanceName , String parserName , BindEntity entity ) { BindTransform bindTransform ; int count = 0 ; for ( BindProperty property : entity . getCollection ( ) ) { if ( property . xmlInfo . xmlType ...
Parse entity properties and write code to read only CData Text fields .
4,470
private static void generateParseOnJackson ( BindTypeContext context , BindEntity entity ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "parseOnJackson" ) . addJavadoc ( "parse with jackson\n" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( typeName ( ...
Generate parse on jackson .
4,471
private static void generateSerializeOnJackson ( BindTypeContext context , BindEntity entity ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "serializeOnJackson" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( typeName ( entity . getElement ( ) ) , "obj...
Generate serialize on jackson .
4,472
private static void generateSerializeOnXml ( BindTypeContext context , BindEntity entity ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "serializeOnXml" ) . addJavadoc ( "method for xml serialization\n" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( t...
Generate serialize on xml .
4,473
public void nextPage ( ) { if ( ! paged ) { this . firstPage ( ) ; paged = true ; } else if ( ! isLast ( ) ) { offset = ( getPageNumber ( ) + 1 ) * pageSize ; execute ( ) ; } }
Next page .
4,474
public static JQL buildJQL ( final SQLiteModelMethod method , String preparedJql ) { Map < JQLDynamicStatementType , String > dynamicReplace = new HashMap < > ( ) ; final JQL result = new JQL ( ) ; forEachParameter ( method , new OnMethodParameterListener ( ) { public void onMethodParameter ( VariableElement item ) { i...
Builds the JQL .
4,475
private static void checkFieldsDefinitions ( SQLiteModelMethod method , Class < ? extends Annotation > annotation ) { List < String > includedFields = AnnotationUtility . extractAsStringArray ( method . getElement ( ) , annotation , AnnotationAttributeType . FIELDS ) ; List < String > excludedFields = AnnotationUtility...
Check fields definitions .
4,476
private static < A extends Annotation > LinkedHashSet < String > extractFieldsFromAnnotation ( final SQLiteModelMethod method , Class < A > annotationClazz , final boolean includePrimaryKey ) { final SQLiteEntity entity = method . getEntity ( ) ; List < String > annotatedFieldValues = AnnotationUtility . extractAsStrin...
Extract fields from annotation .
4,477
private static boolean isInSet ( String value , Set < JQLPlaceHolder > parametersUsedInWhereConditions ) { for ( JQLPlaceHolder ph : parametersUsedInWhereConditions ) { if ( ph . value . equals ( value ) ) return true ; } return false ; }
Checks if is in set .
4,478
private static < L extends Annotation > String defineOrderByStatement ( final SQLiteModelMethod method , final JQL result , Class < L > annotation , Map < JQLDynamicStatementType , String > dynamicReplace ) { StringBuilder builder = new StringBuilder ( ) ; String orderBy = AnnotationUtility . extractAsString ( method ....
Define ORDER BY statement .
4,479
private static void forEachParameter ( SQLiteModelMethod method , OnMethodParameterListener listener ) { for ( VariableElement p : method . getElement ( ) . getParameters ( ) ) { listener . onMethodParameter ( p ) ; } }
For each parameter .
4,480
public static void infoOnGeneratedClasses ( Class < ? extends Annotation > annotation , String packageName , String className ) { String msg = String . format ( "class '%s' in package '%s' is generated by '@%s' annotation processor" , className , packageName , annotation . getSimpleName ( ) ) ; printMessage ( msg ) ; }
KRIPTON_DEBUG info about generated classes .
4,481
public static void infoOnGeneratedFile ( Class < BindDataSource > annotation , File schemaCreateFile ) { String msg = String . format ( "file '%s' in directory '%s' is generated by '@%s' annotation processor" , schemaCreateFile . getName ( ) , schemaCreateFile . getParentFile ( ) , annotation . getSimpleName ( ) ) ; pr...
Info on generated file .
4,482
public static String getNameParameterOfType ( ModelMethod method , TypeName parameter ) { for ( Pair < String , TypeName > item : method . getParameters ( ) ) { if ( item . value1 . equals ( parameter ) ) { return item . value0 ; } } return null ; }
Gets the name parameter of type .
4,483
public static void generateSelect ( Builder builder , SQLiteModelMethod method ) throws ClassNotFoundException { SelectType selectResultType = SelectBuilderUtility . detectSelectType ( method ) ; selectResultType . generate ( builder , method ) ; if ( method . hasLiveData ( ) ) { selectResultType . generateLiveData ( b...
Generate select .
4,484
public static String convertJQL2SQL ( final SQLiteModelMethod method , final boolean replaceWithQuestion ) { JQLChecker jqlChecker = JQLChecker . getInstance ( ) ; String sql = jqlChecker . replace ( method , method . jql , new JQLReplacerListenerImpl ( method ) { public String onBindParameter ( String bindParameterNam...
Convert JQL 2 SQL .
4,485
public Iterator < Map . Entry < K , V > > descendingIterator ( ) { DescendingIterator < K , V > iterator = new DescendingIterator < > ( mEnd , mStart ) ; mIterators . put ( iterator , false ) ; return iterator ; }
Descending iterator .
4,486
public IteratorWithAdditions iteratorWithAdditions ( ) { @ SuppressWarnings ( "unchecked" ) IteratorWithAdditions iterator = new IteratorWithAdditions ( ) ; mIterators . put ( iterator , false ) ; return iterator ; }
return an iterator with additions .
4,487
public static void generateJavadocGeneratedBy ( Builder builder ) { if ( ! BindDataSourceSubProcessor . JUNIT_TEST_MODE ) { builder . addJavadoc ( "<p><strong>This class is generated by Kripton Annotation Processor - v. $L</strong></p>\n" , Version . getVersion ( ) ) ; builder . addJavadoc ( "<p><strong>Generation-time...
Generate javadoc generated by .
4,488
public static String generateColumnCheckSet ( TypeSpec . Builder builder , SQLiteModelMethod method , Set < String > columnNames ) { String columnNameSet = method . contentProviderMethodName + "ColumnSet" ; StringBuilder initBuilder = new StringBuilder ( ) ; String temp = "" ; for ( String item : columnNames ) { initBu...
check used columns .
4,489
static List < JQLPlaceHolder > removeDynamicPlaceHolder ( List < JQLPlaceHolder > placeHolders ) { List < JQLPlaceHolder > result = new ArrayList < > ( ) ; for ( JQLPlaceHolder item : placeHolders ) { if ( item . type != JQLPlaceHolderType . DYNAMIC_SQL ) { result . add ( item ) ; } } return result ; }
Removes the dynamic place holder .
4,490
static boolean validate ( String value , List < JQLPlaceHolder > placeHolders , int pos ) { return placeHolders . get ( pos ) . value . equals ( value ) ; }
look for variable name in place holders defined through path of content provider .
4,491
public static void generateJavaDocForContentProvider ( final SQLiteModelMethod method , MethodSpec . Builder methodBuilder ) { String operation = method . jql . operationType . toString ( ) ; methodBuilder . addJavadoc ( "<h1>Content provider URI ($L operation):</h1>\n" , operation ) ; methodBuilder . addJavadoc ( "<pr...
Generate java doc for content provider .
4,492
public static void forEachMethods ( TypeElement typeElement , MethodFoundListener listener ) { Elements elementUtils = BaseProcessor . elementUtils ; List < ? extends Element > list = elementUtils . getAllMembers ( typeElement ) ; for ( Element item : list ) { if ( item . getKind ( ) == ElementKind . METHOD ) { listene...
Iterate over methods .
4,493
public static Pair < String , TypeName > searchInEachParameter ( ModelMethod method , OnParameterListener listener ) { for ( Pair < String , TypeName > item : method . getParameters ( ) ) { if ( listener . onParameter ( item ) ) { return item ; } } return null ; }
Iterate for each method s parameter
4,494
public static int countParameterOfType ( ModelMethod method , TypeName parameter ) { int counter = 0 ; for ( Pair < String , TypeName > item : method . getParameters ( ) ) { if ( item . value1 . equals ( parameter ) ) { counter ++ ; } } return counter ; }
Count parameter of type .
4,495
public static void generateLogForContentValuesContentProvider ( SQLiteModelMethod method , MethodSpec . Builder methodBuilder ) { methodBuilder . addCode ( "\n// log for content values -- BEGIN\n" ) ; methodBuilder . addStatement ( "Object _contentValue" ) ; methodBuilder . beginControlFlow ( "for (String _contentKey:_...
Generate log for content values content provider .
4,496
public static List < Pair < String , TypeName > > orderContentValues ( final SQLiteModelMethod method , final List < Pair < String , TypeName > > updateableParams ) { final List < Pair < String , TypeName > > result = new ArrayList < Pair < String , TypeName > > ( ) ; JQLChecker checker = JQLChecker . getInstance ( ) ;...
Order content values .
4,497
public static TypeName extractReturnType ( final SQLiteModelMethod method ) { SQLiteEntity daoEntity = method . getParent ( ) . getEntity ( ) ; TypeName returnTypeName = method . getReturnClass ( ) ; TypeName result = null ; if ( TypeUtility . isTypeIncludedIn ( returnTypeName , Void . class , Void . TYPE ) ) { Pair < ...
Detect result type .
4,498
private void generateDaoPart ( M2MEntity entity ) { String daoClassName = entity . daoName . simpleName ( ) ; String daoPackageName = entity . daoName . packageName ( ) ; String entityPackageName = entity . getPackageName ( ) ; String generatedDaoClassName = "Generated" + daoClassName ; AnnotationProcessorUtilis . info...
Generate dao part .
4,499
private boolean isMethodAlreadyDefined ( M2MEntity entity , final String methodName ) { final One < Boolean > found = new One < Boolean > ( false ) ; SqlBuilderHelper . forEachMethods ( entity . daoElement , new MethodFoundListener ( ) { public void onMethod ( ExecutableElement executableMethod ) { if ( executableMetho...
analyze DAO definition to check if method is already defined .