idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
4,600
public static void generateFieldPersistance ( BindTypeContext context , List < ? extends ManagedModelProperty > collection , PersistType persistType , boolean forceName , Modifier ... modifiers ) { for ( ManagedModelProperty property : collection ) { if ( property . bindProperty != null && ! property . hasTypeAdapter (...
Manage field s persistence for both in SharedPreference and SQLite flavours .
4,601
public static void generateFieldSerialize ( BindTypeContext context , PersistType persistType , BindProperty property , Modifier ... modifiers ) { Converter < String , String > format = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; String methodName = "serialize" + format . convert ( property . ...
generates code to manage field serialization .
4,602
public static void generateParamSerializer ( BindTypeContext context , String propertyName , TypeName parameterTypeName , PersistType persistType ) { propertyName = SQLiteDaoDefinition . PARAM_SERIALIZER_PREFIX + propertyName ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( propertyName ) . addJavado...
Generate param serializer .
4,603
public static void generateParamParser ( BindTypeContext context , String methodName , TypeName parameterTypeName , PersistType persistType ) { methodName = SQLiteDaoDefinition . PARAM_PARSER_PREFIX + methodName ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( methodName ) . addJavadoc ( "for param $...
Generate param parser .
4,604
protected void checkTypeAdapter ( @ SuppressWarnings ( "rawtypes" ) ModelEntity entity , TypeMirror propertyType , TypeAdapter typeAdapter , ModelAnnotation annotation ) { TypeName sourceType = TypeUtility . typeName ( TypeAdapterHelper . detectSourceType ( entity . getElement ( ) , typeAdapter . adapterClazz ) ) ; Typ...
Check type adapter .
4,605
private static boolean contentEquals ( String s , char [ ] chars , int start , int length ) { if ( s . length ( ) != length ) { return false ; } for ( int i = 0 ; i < length ; i ++ ) { if ( chars [ start + i ] != s . charAt ( i ) ) { return false ; } } return true ; }
Content equals .
4,606
public E findImmutablePropertyByName ( String name ) { String lcName = name . toLowerCase ( ) ; for ( E item : immutableCollection ) { if ( item . getName ( ) . toLowerCase ( ) . equals ( lcName ) ) { return item ; } } return null ; }
Find property by name .
4,607
public static DynamicByteBuffer createExact ( final int capacity ) { return new DynamicByteBuffer ( capacity ) { public DynamicByteBuffer add ( byte [ ] chars ) { DynamicByteBufferHelper . _idx ( buffer , length , chars ) ; length += chars . length ; return this ; } } ; }
Creates the exact .
4,608
public void addUnsignedByte ( short value ) { if ( 1 + length < capacity ) { DynamicByteBufferHelper . unsignedByteTo ( buffer , length , value ) ; } else { buffer = DynamicByteBufferHelper . grow ( buffer , buffer . length * 2 + 1 ) ; capacity = buffer . length ; DynamicByteBufferHelper . unsignedByteTo ( buffer , len...
Adds the unsigned byte .
4,609
public DynamicByteBuffer addUnsignedInt ( long value ) { if ( 4 + length < capacity ) { DynamicByteBufferHelper . unsignedIntTo ( buffer , length , value ) ; } else { buffer = DynamicByteBufferHelper . grow ( buffer , buffer . length * 2 + 4 ) ; capacity = buffer . length ; DynamicByteBufferHelper . unsignedIntTo ( buf...
Adds the unsigned int .
4,610
public void addUnsignedShort ( int value ) { if ( 2 + length < capacity ) { DynamicByteBufferHelper . unsignedShortTo ( buffer , length , value ) ; } else { buffer = DynamicByteBufferHelper . grow ( buffer , buffer . length * 2 + 2 ) ; capacity = buffer . length ; DynamicByteBufferHelper . unsignedShortTo ( buffer , le...
Adds the unsigned short .
4,611
public void writeLargeDoubleArray ( double [ ] values ) { int byteSize = values . length * 8 + 4 ; this . add ( values . length ) ; doWriteDoubleArray ( values , byteSize ) ; }
Write large double array .
4,612
public void writeLargeLongArray ( long [ ] values ) { int byteSize = values . length * 8 + 4 ; this . add ( values . length ) ; doWriteLongArray ( values , byteSize ) ; }
Write large long array .
4,613
public void writeLargeString ( String s ) { final byte [ ] bytes = DynamicByteBufferHelper . bytes ( s ) ; this . add ( bytes . length ) ; this . add ( bytes ) ; }
Write large string .
4,614
public void writeMediumDoubleArray ( double [ ] values ) { int byteSize = values . length * 8 + 2 ; this . addUnsignedShort ( values . length ) ; doWriteDoubleArray ( values , byteSize ) ; }
Write medium double array .
4,615
public void writeMediumFloatArray ( float [ ] values ) { int byteSize = values . length * 4 + 2 ; this . addUnsignedShort ( values . length ) ; doWriteFloatArray ( values , byteSize ) ; }
Write medium float array .
4,616
public void writeMediumLongArray ( long [ ] values ) { int byteSize = values . length * 8 + 2 ; this . addUnsignedShort ( values . length ) ; doWriteLongArray ( values , byteSize ) ; }
Write medium long array .
4,617
public void writeMediumShortArray ( short [ ] values ) { int byteSize = values . length * 2 + 2 ; this . addUnsignedShort ( values . length ) ; doWriteShortArray ( values , byteSize ) ; }
Write medium short array .
4,618
public void writeMediumString ( String s ) { final byte [ ] bytes = DynamicByteBufferHelper . bytes ( s ) ; this . addUnsignedShort ( bytes . length ) ; this . add ( bytes ) ; }
Write medium string .
4,619
public void writeSmallDoubleArray ( double [ ] values ) { int byteSize = values . length * 8 + 1 ; this . addUnsignedByte ( ( short ) values . length ) ; doWriteDoubleArray ( values , byteSize ) ; }
Write small double array .
4,620
public void writeSmallLongArray ( long [ ] values ) { int byteSize = values . length * 8 + 1 ; this . addUnsignedByte ( ( short ) values . length ) ; doWriteLongArray ( values , byteSize ) ; }
Write small long array .
4,621
public void writeSmallShortArray ( short [ ] values ) { int byteSize = values . length * 2 + 1 ; this . addUnsignedByte ( ( short ) values . length ) ; doWriteShortArray ( values , byteSize ) ; }
Write small short array .
4,622
public void writeSmallString ( String s ) { final byte [ ] bytes = DynamicByteBufferHelper . bytes ( s ) ; this . addUnsignedByte ( ( short ) bytes . length ) ; this . add ( bytes ) ; }
Write small string .
4,623
public String getQualifiedName ( ) { if ( StringUtils . hasText ( packageName ) ) { return packageName + "." + typeSpec . name ; } return typeSpec . name ; }
Gets the qualified name .
4,624
public static void writeJava2File ( Filer filer , String packageName , TypeSpec typeSpec ) throws IOException { JavaFile target = JavaFile . builder ( packageName , typeSpec ) . skipJavaLangImports ( true ) . build ( ) ; target . writeTo ( filer ) ; }
Write java 2 file .
4,625
public static ClassName generateDaoFactoryClassName ( SQLiteDatabaseSchema schema ) { String schemaName = buildDaoFactoryName ( schema ) ; String packageName = TypeUtility . extractPackageName ( schema . getElement ( ) ) ; return ClassName . get ( packageName , schemaName ) ; }
Given a schema generate its daoFactory name .
4,626
public static void init ( Context contextValue , ExecutorService service ) { context = contextValue ; if ( service == null ) { executerService = Executors . newFixedThreadPool ( THREAD_POOL_SIZE_DEFAULT ) ; } else { executerService = service ; } }
Method to invoke during application initialization .
4,627
private MethodSpec . Builder generateExecuteMethod ( String packageName , SQLiteEntity entity ) { ParameterizedTypeName parameterizedReturnTypeName = ParameterizedTypeName . get ( className ( ArrayList . class ) , className ( packageName , entity . getSimpleName ( ) ) ) ; MethodSpec . Builder methodBuilder = MethodSpec...
Generate execute method .
4,628
protected Class < ? > defineCollectionClass ( ParameterizedTypeName collectionTypeName ) { if ( collectionTypeName . rawType . toString ( ) . startsWith ( collectionClazz . getCanonicalName ( ) ) ) { return defaultClazz ; } else if ( collectionTypeName . rawType . toString ( ) . startsWith ( SortedMap . class . getCano...
Define collection class .
4,629
public static ClassName defineCollection ( TypeName listClazzName ) { try { Class < ? > clazz = null ; if ( listClazzName instanceof ParameterizedTypeName ) { ParameterizedTypeName returnListName = ( ParameterizedTypeName ) listClazzName ; clazz = Class . forName ( returnListName . rawType . toString ( ) ) ; } else { c...
Define collection .
4,630
public void putNull ( String key ) { if ( this . compiledStatement != null ) { compiledStatement . bindNull ( compiledStatementBindIndex ++ ) ; } else if ( values != null ) { values . putNull ( key ) ; return ; } names . add ( key ) ; args . add ( null ) ; valueType . add ( ParamType . NULL ) ; }
Adds a null value to the set .
4,631
public void addWhereArgs ( String value ) { if ( this . compiledStatement != null ) { compiledStatement . bindString ( compiledStatementBindIndex ++ , value ) ; } whereArgs . add ( value ) ; valueType . add ( ParamType . STRING ) ; }
Adds the where args .
4,632
public void clear ( ) { names . clear ( ) ; values = null ; valueType . clear ( ) ; args . clear ( ) ; whereArgs . clear ( ) ; compiledStatement = null ; compiledStatementBindIndex = 1 ; }
Removes all values .
4,633
public String keyList ( ) { String separator = "" ; StringBuilder buffer = new StringBuilder ( ) ; String item ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { item = names . get ( i ) ; buffer . append ( separator + item ) ; separator = ", " ; } return buffer . toString ( ) ; }
Key list .
4,634
public String keyValueList ( ) { String separator = "" ; StringBuilder buffer = new StringBuilder ( ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { buffer . append ( separator + "?" ) ; separator = ", " ; } return buffer . toString ( ) ; }
Key value list .
4,635
private Class < ? > replaceInterface ( Class < ? > clazz ) { if ( clazz . equals ( List . class ) ) { return ArrayList . class ; } if ( clazz . equals ( Set . class ) ) { return HashSet . class ; } if ( clazz . equals ( Map . class ) ) { return HashMap . class ; } return clazz ; }
Replace interface .
4,636
private void checkRelaxed ( String errorMessage ) { if ( ! relaxed ) { throw new KriptonRuntimeException ( errorMessage , true , this . getLineNumber ( ) , this . getColumnNumber ( ) , getPositionDescription ( ) , null ) ; } if ( error == null ) { error = "Error: " + errorMessage ; } }
Check relaxed .
4,637
private String readUntil ( char [ ] delimiter , boolean returnText ) throws IOException , KriptonRuntimeException { int start = position ; StringBuilder result = null ; if ( returnText && text != null ) { result = new StringBuilder ( ) ; result . append ( text ) ; } search : while ( true ) { if ( position + delimiter ....
Reads text until the specified delimiter is encountered . Consumes the text and the delimiter .
4,638
private void readXmlDeclaration ( ) throws IOException , KriptonRuntimeException { if ( bufferStartLine != 0 || bufferStartColumn != 0 || position != 0 ) { checkRelaxed ( "processing instructions must not start with xml" ) ; } read ( START_PROCESSING_INSTRUCTION ) ; parseStartTag ( true , true ) ; if ( attributeCount <...
Returns true if an XML declaration was read .
4,639
private String readComment ( boolean returnText ) throws IOException , KriptonRuntimeException { read ( START_COMMENT ) ; if ( relaxed ) { return readUntil ( END_COMMENT , returnText ) ; } String commentText = readUntil ( COMMENT_DOUBLE_DASH , returnText ) ; if ( peekCharacter ( ) != '>' ) { throw new KriptonRuntimeExc...
Read comment .
4,640
private void readInternalSubset ( ) throws IOException , KriptonRuntimeException { read ( '[' ) ; while ( true ) { skip ( ) ; if ( peekCharacter ( ) == ']' ) { position ++ ; return ; } int declarationType = peekType ( true ) ; switch ( declarationType ) { case ELEMENTDECL : readElementDeclaration ( ) ; break ; case ATT...
Read internal subset .
4,641
private void readNotationDeclaration ( ) throws IOException , KriptonRuntimeException { read ( START_NOTATION ) ; skip ( ) ; readName ( ) ; if ( ! readExternalId ( false , false ) ) { throw new KriptonRuntimeException ( "Expected external ID or public ID for notation" , true , this . getLineNumber ( ) , this . getColum...
Read notation declaration .
4,642
private void readEndTag ( ) throws IOException , KriptonRuntimeException { read ( '<' ) ; read ( '/' ) ; name = readName ( ) ; skip ( ) ; read ( '>' ) ; int sp = ( depth - 1 ) * 4 ; if ( depth == 0 ) { checkRelaxed ( "read end tag " + name + " with no tags open" ) ; type = COMMENT ; return ; } if ( name . equals ( elem...
Read end tag .
4,643
private String readName ( ) throws IOException , KriptonRuntimeException { if ( position >= limit && ! fillBuffer ( 1 ) ) { checkRelaxed ( "name expected" ) ; return "" ; } int start = position ; StringBuilder result = null ; char c = buffer [ position ] ; if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || c ...
Returns an element or attribute name . This is always non - empty for non - relaxed parsers .
4,644
public T get ( String name ) { String lcName = name . toLowerCase ( ) ; for ( T item : collection ) { if ( item . getName ( ) . toLowerCase ( ) . equals ( lcName ) ) { return item ; } } return null ; }
Find for contained element using its name .
4,645
public static void javaProperty2ContentValues ( MethodSpec . Builder methodBuilder , TypeName beanClass , String beanName , ModelProperty property ) { TypeName typeName = null ; if ( property != null && property . getPropertyType ( ) != null ) { typeName = property . getPropertyType ( ) . getTypeName ( ) ; } if ( prope...
Used to convert a property of managed bean to contentValue .
4,646
public static void javaProperty2WhereCondition ( MethodSpec . Builder methodBuilder , SQLiteModelMethod method , String paramName , TypeName paramType , ModelProperty property ) { if ( property != null && property . hasTypeAdapter ( ) ) { methodBuilder . addCode ( AbstractSQLTransform . PRE_TYPE_ADAPTER_TO_STRING + "$L...
Used to convert a property of managed bean to where condition .
4,647
public static void javaMethodParam2ContentValues ( MethodSpec . Builder methodBuilder , SQLiteModelMethod method , String paramName , TypeName paramType , ModelProperty property ) { AssertKripton . assertTrueOrInvalidMethodSignException ( ! method . hasAdapterForParam ( paramName ) , method , "method's parameter '%s' c...
Used to convert a method s parameter to contentValues . It can not have a type adpter because it eventually use the one define in associated bean s attribute
4,648
public static boolean isSupportedJDKType ( TypeName typeName ) { if ( typeName . isPrimitive ( ) ) { return getPrimitiveTransform ( typeName ) != null ; } String name = typeName . toString ( ) ; if ( name . startsWith ( "java.lang" ) ) { return getLanguageTransform ( typeName ) != null ; } if ( name . startsWith ( "jav...
Checks if is supported JDK type .
4,649
public static void resetBean ( MethodSpec . Builder methodBuilder , TypeName beanClass , String beanName , ModelProperty property , String cursorName , String indexName ) { SQLTransform transform = lookup ( property . getElement ( ) . asType ( ) ) ; if ( transform == null ) { throw new IllegalArgumentException ( "Trans...
Reset bean .
4,650
public static String columnTypeAsString ( SQLProperty property ) { if ( property . columnAffinityType != null && ColumnAffinityType . AUTO != property . columnAffinityType ) { return property . columnAffinityType . toString ( ) ; } TypeName typeName = property . getPropertyType ( ) . getTypeName ( ) ; if ( property . h...
Detect column type . If column affinity is specified by annotation affinity column is used .
4,651
public Map . Entry < K , V > ceil ( K k ) { if ( contains ( k ) ) { return mHashMap . get ( k ) . mPrevious ; } return null ; }
Return an entry added to prior to an entry associated with the given key .
4,652
public static < D , J > J toJava ( Class < ? extends PreferenceTypeAdapter < J , D > > clazz , D value ) { @ SuppressWarnings ( "unchecked" ) PreferenceTypeAdapter < J , D > adapter = cache . get ( clazz ) ; if ( adapter == null ) { adapter = generateAdapter ( clazz ) ; } return adapter . toJava ( value ) ; }
To java .
4,653
public static boolean isStringSet ( PrefsProperty property ) { boolean isStringSet = false ; TypeName typeName ; if ( property . hasTypeAdapter ( ) ) { typeName = TypeUtility . typeName ( property . typeAdapter . dataType ) ; } else { typeName = TypeUtility . typeName ( property . getElement ( ) . asType ( ) ) ; } if (...
Checks if is string set .
4,654
public String getAttributeAsClassName ( AnnotationAttributeType attribute ) { String temp = attributes . get ( attribute . getValue ( ) ) ; if ( StringUtils . hasText ( temp ) ) { temp = temp . replace ( ".class" , "" ) ; } return temp ; }
Gets the attribute as class name .
4,655
public List < String > getAttributeAsArray ( AnnotationAttributeType attribute ) { String temp = attributes . get ( attribute . getValue ( ) ) ; return AnnotationUtility . extractAsArrayOfString ( temp ) ; }
Gets the attribute as array .
4,656
public int getAttributeAsInt ( AnnotationAttributeType attribute ) { String temp = attributes . get ( attribute . getValue ( ) ) ; return Integer . parseInt ( temp ) ; }
Gets the attribute as int .
4,657
protected void generateSubQueries ( Builder methodBuilder , SQLiteModelMethod method ) { SQLiteEntity entity = method . getEntity ( ) ; for ( Triple < String , String , SQLiteModelMethod > item : method . childrenSelects ) { TypeName entityTypeName = TypeUtility . typeName ( entity . getElement ( ) ) ; String setter ; ...
generate code for sub queries
4,658
public void generateCommonPart ( SQLiteModelMethod method , TypeSpec . Builder classBuilder , MethodSpec . Builder methodBuilder , Set < JQLProjection > fieldList , boolean generateSqlField ) { generateCommonPart ( method , classBuilder , methodBuilder , fieldList , GenerationType . ALL , null , generateSqlField , fals...
Generate common part .
4,659
protected MethodSpec . Builder generateMethodBuilder ( SQLiteModelMethod method ) { MethodSpec . Builder methodBuilder ; if ( method . hasLiveData ( ) ) { methodBuilder = MethodSpec . methodBuilder ( method . getName ( ) + LIVE_DATA_PREFIX ) . addModifiers ( Modifier . PROTECTED ) ; } else { methodBuilder = MethodSpec ...
Generate method builder .
4,660
protected void generateMethodSignature ( SQLiteModelMethod method , MethodSpec . Builder methodBuilder , TypeName returnTypeName , ParameterSpec ... additionalParameterSpec ) { boolean finalParameter = false ; if ( method . hasLiveData ( ) && returnTypeName . equals ( method . liveDataReturnClass ) ) { finalParameter =...
Generate method signature .
4,661
public static void checkUnusedParameters ( SQLiteModelMethod method , Set < String > usedMethodParameters , TypeName excludedClasses ) { int paramsCount = method . getParameters ( ) . size ( ) ; int usedCount = usedMethodParameters . size ( ) ; if ( paramsCount > usedCount ) { StringBuilder sb = new StringBuilder ( ) ;...
Check if there are unused method parameters . In this case an exception was throws .
4,662
private static void generateSQLBuild ( SQLiteModelMethod method , MethodSpec . Builder methodBuilder , SplittedSql splittedSql , boolean countQuery ) { methodBuilder . addStatement ( "$T _sqlBuilder=sqlBuilder()" , StringBuilder . class ) ; methodBuilder . addStatement ( "_sqlBuilder.append($S)" , splittedSql . sqlBasi...
Generate SQL build .
4,663
public static String extractClassName ( String fullName ) { int l = fullName . lastIndexOf ( "." ) ; return fullName . substring ( l + 1 ) ; }
Extract class name .
4,664
public static boolean isTypeIncludedIn ( TypeName value , Type ... types ) { for ( Type item : types ) { if ( value . equals ( typeName ( item ) ) ) { return true ; } } return false ; }
Checks if is type included in .
4,665
public static boolean isTypePrimitive ( TypeName value ) { return isTypeIncludedIn ( value , Byte . TYPE , Character . TYPE , Boolean . TYPE , Short . TYPE , Integer . TYPE , Long . TYPE , Float . TYPE , Double . TYPE ) ; }
Checks if is type primitive .
4,666
public static boolean isTypeWrappedPrimitive ( TypeName value ) { return isTypeIncludedIn ( value , Byte . class , Character . class , Boolean . class , Short . class , Integer . class , Long . class , Float . class , Double . class ) ; }
Checks if is type wrapped primitive .
4,667
public static boolean isEquals ( TypeName value , TypeName kindOfParameter ) { return value . toString ( ) . equals ( kindOfParameter . toString ( ) ) ; }
Check if class that is rapresented by value has same typeName of entity parameter .
4,668
public static TypeName typeName ( TypeMirror typeMirror ) { LiteralType literalType = LiteralType . of ( typeMirror . toString ( ) ) ; if ( literalType . isArray ( ) ) { return ArrayTypeName . of ( typeName ( literalType . getRawType ( ) ) ) ; } else if ( literalType . isCollection ( ) ) { return ParameterizedTypeName ...
Convert a TypeMirror in a typeName .
4,669
public static ClassName mergeTypeNameWithSuffix ( TypeName typeName , String typeNameSuffix ) { ClassName className = className ( typeName . toString ( ) ) ; return classNameWithSuffix ( className . packageName ( ) , className . simpleName ( ) , typeNameSuffix ) ; }
Merge type name with suffix .
4,670
public static TypeName typeName ( String typeName ) { TypeName [ ] values = { TypeName . BOOLEAN , TypeName . BYTE , TypeName . CHAR , TypeName . DOUBLE , TypeName . FLOAT , TypeName . INT , TypeName . LONG , TypeName . SHORT , TypeName . VOID } ; for ( TypeName item : values ) { if ( item . toString ( ) . equals ( typ...
Convert a TypeMirror in a typeName or classname or whatever .
4,671
public static void checkTypeCompatibility ( SQLiteModelMethod method , Pair < String , TypeName > item , ModelProperty property ) { if ( ! TypeUtility . isEquals ( item . value1 , property . getPropertyType ( ) . getTypeName ( ) ) ) { throw ( new InvalidMethodSignException ( method , String . format ( "property '%s' is...
Check if type if compatibility .
4,672
public static void beginStringConversion ( Builder methodBuilder , ModelProperty property ) { TypeName modelType = typeName ( property . getElement ( ) . asType ( ) ) ; beginStringConversion ( methodBuilder , modelType ) ; }
generate begin string to translate in code to used in content value or parameter need to be converted in string through String . valueOf
4,673
public static void endStringConversion ( Builder methodBuilder , TypeName typeMirror ) { SQLTransform transform = SQLTransformer . lookup ( typeMirror ) ; switch ( transform . getColumnType ( ) ) { case TEXT : return ; case BLOB : methodBuilder . addCode ( ",$T.UTF_8)" , StandardCharsets . class ) ; break ; case INTEGE...
generate end string to translate in code to used in content value or parameter need to be converted in string through String . valueOf
4,674
public static TypeName typeName ( TypeElement element , String suffix ) { String fullName = element . getQualifiedName ( ) . toString ( ) + suffix ; int lastIndex = fullName . lastIndexOf ( "." ) ; String packageName = fullName . substring ( 0 , lastIndex ) ; String className = fullName . substring ( lastIndex + 1 ) ; ...
Type name .
4,675
public static TypeName parameterizedTypeName ( ClassName rawClass , TypeName paramClass ) { return ParameterizedTypeName . get ( rawClass , paramClass ) ; }
Parameterized type name .
4,676
public static String simpleName ( TypeName clazzName ) { String clazz = clazzName . toString ( ) ; int index = clazz . lastIndexOf ( "." ) ; if ( index > 0 ) { clazz = clazz . substring ( index + 1 ) ; } return clazz ; }
Return simple typeName of class .
4,677
public static boolean isEnum ( String className ) { try { TypeElement element = BindTypeSubProcessor . elementUtils . getTypeElement ( className ) ; if ( element instanceof TypeElement ) { TypeElement typeElement = element ; TypeMirror superclass = typeElement . getSuperclass ( ) ; if ( superclass instanceof DeclaredTy...
Checks if is enum .
4,678
public static boolean isCollectionOfType ( TypeName typeName , TypeName elementTypeName ) { return isAssignable ( typeName , Collection . class ) && isEquals ( ( ( ParameterizedTypeName ) typeName ) . typeArguments . get ( 0 ) , elementTypeName ) ; }
Checks if is collection and if element type is the one passed as parameter .
4,679
public static boolean isAssignable ( TypeName typeName , Class < ? > assignableClazz ) { try { if ( typeName instanceof ParameterizedTypeName ) { typeName = ( ( ParameterizedTypeName ) typeName ) . rawType ; } else if ( typeName instanceof ArrayTypeName ) { typeName = ( ( ArrayTypeName ) typeName ) . componentType ; } ...
Checks if is assignable .
4,680
public static String extractPackageName ( TypeElement element ) { String fullName = element . getQualifiedName ( ) . toString ( ) ; if ( fullName . lastIndexOf ( "." ) > 0 ) { return fullName . substring ( 0 , fullName . lastIndexOf ( "." ) ) ; } return "" ; }
Extract package name .
4,681
protected < L extends JqlBaseListener > void analyzeVariableStatementInternal ( JQLContext jqlContext , final String jql , L listener ) { walker . walk ( listener , prepareVariableStatement ( jqlContext , jql ) . value0 ) ; }
Analyze variable statement internal .
4,682
protected Pair < ParserRuleContext , CommonTokenStream > prepareParser ( final JQLContext jqlContext , final String jql ) { JqlLexer lexer = new JqlLexer ( CharStreams . fromString ( jql ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; JqlParser parser = new JqlParser ( tokens ) ; parser . removeError...
Prepare parser .
4,683
public Set < String > extractColumnsToInsertOrUpdate ( final JQLContext jqlContext , String jqlValue , final Finder < SQLProperty > entity ) { final Set < String > result = new LinkedHashSet < String > ( ) ; final One < Boolean > selectionOn = new One < Boolean > ( null ) ; final One < Boolean > insertOn = new One < Bo...
Extract columns to insert or update .
4,684
private String replaceInternal ( final JQLContext jqlContext , String jql , final List < Triple < Token , Token , String > > replace , JqlBaseListener rewriterListener ) { Pair < ParserRuleContext , CommonTokenStream > parser = prepareParser ( jqlContext , jql ) ; walker . walk ( rewriterListener , parser . value0 ) ; ...
Replace internal .
4,685
private String replaceFromVariableStatementInternal ( JQLContext context , String jql , final List < Triple < Token , Token , String > > replace , JqlBaseListener rewriterListener ) { Pair < ParserRuleContext , CommonTokenStream > parser = prepareVariableStatement ( context , jql ) ; walker . walk ( rewriterListener , ...
Replace from variable statement internal .
4,686
private < L extends Collection < JQLPlaceHolder > > L extractPlaceHolders ( final JQLContext jqlContext , String jql , final L result ) { final One < Boolean > valid = new One < > ( ) ; valid . value0 = false ; analyzeInternal ( jqlContext , jql , new JqlBaseListener ( ) { public void enterBind_parameter ( Bind_paramet...
Extract place holders .
4,687
private < L extends Collection < JQLPlaceHolder > > L extractPlaceHoldersFromVariableStatement ( final JQLContext jqlContext , String jql , final L result ) { final One < Boolean > valid = new One < > ( ) ; if ( ! StringUtils . hasText ( jql ) ) return result ; valid . value0 = false ; analyzeVariableStatementInternal ...
Extract place holders from variable statement .
4,688
void generateSerializeInternal ( BindTypeContext context , MethodSpec . Builder methodBuilder , String serializerName , TypeName beanClass , String beanName , BindProperty property , boolean onString ) { TypeName typeName = property . getPropertyType ( ) . getTypeName ( ) ; String bindName = context . getBindMapperName...
Generate serialize internal .
4,689
public static String daoName ( SQLiteDaoDefinition value ) { String classTableName = value . getName ( ) ; classTableName = classTableName + SUFFIX ; return classTableName ; }
Dao name .
4,690
static List < String > extractAsArrayOfClassName ( String value ) { Matcher matcher = classPattern . matcher ( value ) ; List < String > result = new ArrayList < String > ( ) ; while ( matcher . find ( ) ) { result . add ( matcher . group ( 1 ) ) ; } return result ; }
Extract as array of class name .
4,691
public static List < String > extractAsArrayOfString ( String value ) { Matcher matcher = arrayPattern . matcher ( value ) ; List < String > result = new ArrayList < String > ( ) ; while ( matcher . find ( ) ) { result . add ( StringEscapeUtils . unescapeEcmaScript ( matcher . group ( 1 ) ) ) ; } return result ; }
Extract as array of string .
4,692
public static void forEachAnnotations ( Element currentElement , AnnotationFilter filter , AnnotationFoundListener listener ) { final Elements elementUtils = BaseProcessor . elementUtils ; List < ? extends AnnotationMirror > annotationList = elementUtils . getAllAnnotationMirrors ( currentElement ) ; String annotationC...
Iterate over annotations of currentElement . Accept only annotation in accepted set .
4,693
static void extractString ( Elements elementUtils , Element item , Class < ? extends Annotation > annotationClass , AnnotationAttributeType attribute , OnAttributeFoundListener listener ) { extractAttributeValue ( elementUtils , item , annotationClass . getCanonicalName ( ) , attribute , listener ) ; }
Extract string .
4,694
public static List < ModelAnnotation > buildAnnotationList ( final Element element , final AnnotationFilter filter ) { final List < ModelAnnotation > annotationList = new ArrayList < > ( ) ; forEachAnnotations ( element , filter , new AnnotationFoundListener ( ) { public void onAcceptAnnotation ( Element executableMeth...
Builds the annotation list .
4,695
public static int extractAsInt ( Element item , Class < ? extends Annotation > annotationClass , AnnotationAttributeType attributeName ) { final Elements elementUtils = BaseProcessor . elementUtils ; final One < Integer > result = new One < Integer > ( ) ; result . value0 = 0 ; extractString ( elementUtils , item , ann...
Extract as int .
4,696
public static boolean extractAsBoolean ( Element item , Class < ? extends Annotation > annotationClass , AnnotationAttributeType attribute ) { final Elements elementUtils = BaseProcessor . elementUtils ; final One < Boolean > result = new One < Boolean > ( false ) ; extractString ( elementUtils , item , annotationClass...
Extract as boolean .
4,697
public static < E extends ModelEntity < ? > > boolean extractAsBoolean ( E item , ModelAnnotation annotation , AnnotationAttributeType attribute ) { final Elements elementUtils = BaseProcessor . elementUtils ; final One < Boolean > result = new One < Boolean > ( false ) ; extractAttributeValue ( elementUtils , item . g...
Estract from an annotation of a method the attribute value specified .
4,698
public static Boolean getAnnotationAttributeAsBoolean ( ModelWithAnnotation model , Class < ? extends Annotation > annotation , AnnotationAttributeType attribute , Boolean defaultValue ) { return getAnnotationAttribute ( model , annotation , attribute , defaultValue , new OnAnnotationAttributeListener < Boolean > ( ) {...
Gets the annotation attribute as boolean .
4,699
static < T > T getAnnotationAttribute ( ModelWithAnnotation model , Class < ? extends Annotation > annotation , AnnotationAttributeType attribute , T defaultValue , OnAnnotationAttributeListener < T > listener ) { String attributeResult ; ModelAnnotation item = model . getAnnotation ( annotation ) ; if ( item != null )...
Gets the annotation attribute .