idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
4,500
private void generateInsert ( M2MEntity entity , String packageName ) { if ( ! isMethodAlreadyDefined ( entity , "insert" ) ) { MethodSpec methodSpec = MethodSpec . methodBuilder ( "insert" ) . addModifiers ( Modifier . PUBLIC ) . addModifiers ( Modifier . ABSTRACT ) . addAnnotation ( AnnotationSpec . builder ( BindSql...
Generate insert .
4,501
public static void generate ( Elements elementUtils , Filer filer , SQLiteDatabaseSchema schema ) throws Exception { BindDaoFactoryBuilder visitor = new BindDaoFactoryBuilder ( elementUtils , filer , schema ) ; visitor . buildDaoFactoryInterface ( elementUtils , filer , schema ) ; String daoFactoryName = BindDaoFactory...
Generate database .
4,502
static String defineFileName ( SQLiteDatabaseSchema model ) { int lastIndex = model . fileName . lastIndexOf ( "." ) ; String schemaName = model . fileName ; if ( lastIndex > - 1 ) { schemaName = model . fileName . substring ( 0 , lastIndex ) ; } schemaName = schemaName . toLowerCase ( ) + "_schema_" + model . version ...
Define file name .
4,503
public static ClassName generateDataSourceName ( SQLiteDatabaseSchema schema ) { String dataSourceName = schema . getName ( ) ; dataSourceName = PREFIX + dataSourceName ; PackageElement pkg = BaseProcessor . elementUtils . getPackageOf ( schema . getElement ( ) ) ; String packageName = pkg . isUnnamed ( ) ? "" : pkg . ...
Generate dataSource name .
4,504
public static void generateDaoUids ( TypeSpec . Builder classBuilder , SQLiteDatabaseSchema schema ) { for ( SQLiteDaoDefinition dao : schema . getCollection ( ) ) { classBuilder . addField ( FieldSpec . builder ( Integer . TYPE , dao . daoUidName , Modifier . FINAL , Modifier . STATIC , Modifier . PUBLIC ) . initializ...
Generate Dao s UID . If specified prefix will be used to
4,505
private String extractDaoFieldNameForInternalDataSource ( SQLiteDaoDefinition dao ) { return "_" + CaseFormat . UPPER_CAMEL . to ( CaseFormat . LOWER_CAMEL , dao . getName ( ) ) ; }
Extract dao field name for internal data source .
4,506
private void generatePopulate ( SQLiteDatabaseSchema schema , MethodSpec . Builder methodBuilder , boolean instance ) { methodBuilder . beginControlFlow ( "try" ) ; methodBuilder . addStatement ( "instance.openWritableDatabase()" ) ; methodBuilder . addStatement ( "instance.close()" ) ; if ( ( instance && schema . conf...
Generate populate .
4,507
private void generateOpen ( String schemaName ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "open" ) . addModifiers ( Modifier . PUBLIC , Modifier . STATIC ) . returns ( className ( schemaName ) ) ; methodBuilder . addJavadoc ( "Retrieve data source instance and open it.\n" ) ; methodBuilder . a...
Generate open .
4,508
private void generateOnConfigure ( boolean useForeignKey ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "onConfigure" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) ; methodBuilder . addParameter ( SQLiteDatabase . class , "database" ) ; methodBuilder . addJavadoc ( "...
Generate on configure .
4,509
public static List < SQLiteEntity > orderEntitiesList ( SQLiteDatabaseSchema schema ) { List < SQLiteEntity > entities = schema . getEntitiesAsList ( ) ; Collections . sort ( entities , new Comparator < SQLiteEntity > ( ) { public int compare ( SQLiteEntity lhs , SQLiteEntity rhs ) { return lhs . getTableName ( ) . com...
Generate ordered entities list .
4,510
private void generateRxInterface ( String daoFactory , RxInterfaceType interfaceType , Class < ? > clazz ) { { ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName . get ( ClassName . get ( clazz ) , TypeVariableName . get ( "T" ) ) ; String preExecutorName = clazz . getSimpleName ( ) . replace ( "Emitte...
Generate rx interface .
4,511
private static void generateEditor ( PrefsEntity entity ) { com . abubusoft . kripton . common . Converter < String , String > converter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; Builder innerClassBuilder = TypeSpec . classBuilder ( "BindEditor" ) . addModifiers ( Modifier . PUBLIC ) . add...
create editor .
4,512
private static void generateInstance ( String className ) { builder . addField ( FieldSpec . builder ( className ( className ) , "instance" , Modifier . PRIVATE , Modifier . STATIC ) . addJavadoc ( "instance of shared preferences\n" ) . build ( ) ) ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "ge...
Generate instance of shared preferences .
4,513
private static void generateRefresh ( String sharedPreferenceName , String className ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "refresh" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "force to refresh values\n" ) . returns ( className ( className ) ) ; method . addStatement ( "createPrefs()...
Generate refresh .
4,514
private static void generateResetMethod ( PrefsEntity entity ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "reset" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "reset shared preferences\n" ) . returns ( Void . TYPE ) ; if ( entity . isImmutablePojo ( ) ) { ImmutableUtility . generateImmutableV...
Generate reset method .
4,515
private static void generateWriteMethod ( PrefsEntity entity ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "write" ) . addJavadoc ( "write bean entirely\n\n" ) . addJavadoc ( "@param bean bean to entirely write\n" ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( typeName ( entity . getName ( ) )...
Generate write method .
4,516
private static void generateReadMethod ( PrefsEntity entity ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "read" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "read bean entirely\n\n" ) . addJavadoc ( "@return read bean\n" ) . returns ( typeName ( entity . getName ( ) ) ) ; if ( entity ....
Generate read method .
4,517
private static void generateSingleReadMethod ( PrefsEntity entity ) { PrefsTransform transform ; Converter < String , String > converter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; for ( PrefsProperty item : entity . getCollection ( ) ) { MethodSpec . Builder methodBuilder = MethodSpec . met...
Generate single read method .
4,518
protected void serialize ( BinderContext context , E object , SerializerWrapper serializerWrapper , boolean writeStartAndEnd ) throws Exception { switch ( context . getSupportedFormat ( ) ) { case XML : try { XmlWrapperSerializer wrapper = ( ( XmlWrapperSerializer ) serializerWrapper ) ; XMLSerializer xmlSerializer = w...
Serialize an object using the contxt and the serializerWrapper .
4,519
@ SuppressWarnings ( "unchecked" ) public static < T > Set < T > asSet ( Class < T > itemType , T ... objects ) { LinkedHashSet < T > result = new LinkedHashSet < T > ( ) ; for ( T item : objects ) { result . add ( item ) ; } return result ; }
create a collection set with initial values .
4,520
public static < E extends List < Boolean > > E asList ( boolean [ ] array , Class < E > listType ) { E result ; try { result = listType . newInstance ( ) ; for ( Object item : array ) { result . add ( ( boolean ) item ) ; } return result ; } catch ( InstantiationException | IllegalAccessException e ) { e . printStackTr...
As list .
4,521
public static byte [ ] asByteTypeArray ( List < Byte > input ) { byte [ ] result = new byte [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As byte type array .
4,522
public static char [ ] asCharacterTypeArray ( List < Character > input ) { char [ ] result = new char [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As character type array .
4,523
public static short [ ] asShortTypeArray ( List < Short > input ) { short [ ] result = new short [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As short type array .
4,524
public static int [ ] asIntegerTypeArray ( List < Integer > input ) { int [ ] result = new int [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As integer type array .
4,525
public static long [ ] asLongTypeArray ( List < Long > input ) { long [ ] result = new long [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As long type array .
4,526
public static float [ ] asFloatTypeArray ( List < Float > input ) { float [ ] result = new float [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As float type array .
4,527
public static String [ ] asStringArray ( List < String > input ) { String [ ] result = new String [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As string array .
4,528
public static Boolean [ ] asBooleanArray ( List < Boolean > input ) { Boolean [ ] result = new Boolean [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As boolean array .
4,529
public static < E > E [ ] asArray ( List < E > input , E [ ] newArray ) { return input . toArray ( newArray ) ; }
As array .
4,530
public static Double [ ] asDoubleArray ( List < Double > input ) { Double [ ] result = new Double [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As double array .
4,531
public static void trim ( List < String > value ) { if ( value == null ) return ; for ( int i = 0 ; i < value . size ( ) ; i ++ ) { value . set ( i , value . get ( i ) . trim ( ) ) ; } }
trim each element of lists .
4,532
public static String resolveFullyQualifiedColumnName ( SQLiteDatabaseSchema schema , SQLiteModelMethod method , String className , String columnName ) { Finder < SQLProperty > currentEntity = method . getEntity ( ) ; if ( StringUtils . hasText ( className ) ) { currentEntity = schema . getEntityBySimpleName ( className...
given a fully qualified property name it will be transformed in associated column name . If class or property does not exist an exception will be thrown
4,533
public static boolean isLiveData ( SQLiteModelMethod methodDefinition ) { boolean result = false ; TypeName returnTypeName = methodDefinition . getReturnClass ( ) ; if ( returnTypeName instanceof ParameterizedTypeName ) { ParameterizedTypeName returnParameterizedTypeName = ( ParameterizedTypeName ) returnTypeName ; Cla...
Checks if is live data .
4,534
private String getJQLDeclared ( ) { ModelAnnotation inserAnnotation = this . getAnnotation ( BindSqlInsert . class ) ; ModelAnnotation updateAnnotation = this . getAnnotation ( BindSqlUpdate . class ) ; ModelAnnotation selectAnnotation = this . getAnnotation ( BindSqlSelect . class ) ; ModelAnnotation deleteAnnotation ...
Gets the JQL declared .
4,535
private < A extends Annotation > void findStringDynamicStatement ( SQLiteDaoDefinition parent , Class < A > annotationClazz , List < Class < ? extends Annotation > > unsupportedQueryType , OnFoundDynamicParameter listener ) { int counter = 0 ; for ( VariableElement p : element . getParameters ( ) ) { A annotation = p ....
Look for a method parameter which is annotated with an annotationClass annotation . When it is found a client action is required through listener .
4,536
public String findParameterAliasByName ( String name ) { if ( parameterName2Alias . containsKey ( name ) ) { return parameterName2Alias . get ( name ) ; } return name ; }
Retrieve for a method s parameter its alias used to work with queries . If no alias is present typeName will be used .
4,537
public TypeName getAdapterForParam ( String paramName ) { if ( this . hasAdapterForParam ( paramName ) ) { return TypeUtility . typeName ( this . parameterName2Adapter . get ( paramName ) ) ; } else { return null ; } }
Gets the adapter for param .
4,538
public String findEntityProperty ( ) { SQLiteEntity entity = getEntity ( ) ; for ( Pair < String , TypeName > item : this . parameters ) { if ( item . value1 . equals ( TypeUtility . typeName ( entity . getElement ( ) ) ) ) { return item . value0 ; } } return null ; }
Find entity property .
4,539
public String buildPreparedStatementName ( ) { if ( ! StringUtils . hasText ( preparedStatementName ) ) { preparedStatementName = getParent ( ) . buildPreparedStatementName ( getName ( ) ) ; } return preparedStatementName ; }
Builds the prepared statement name .
4,540
public static String checkSize ( Object value , int limitSize , String defaultValue ) { if ( value != null ) { if ( byte [ ] . class . getSimpleName ( ) . equals ( value . getClass ( ) . getSimpleName ( ) ) ) { return checkSize ( ( byte [ ] ) value , limitSize / 2 ) ; } String str = value . toString ( ) ; if ( str . le...
limit string size .
4,541
public static String bytesToHex ( byte [ ] bytes , int size ) { size = Math . min ( bytes . length , size ) ; char [ ] hexChars = new char [ size * 2 ] ; for ( int j = 0 ; j < size ; j ++ ) { int v = bytes [ j ] & 0xFF ; hexChars [ j * 2 ] = hexArray [ v >>> 4 ] ; hexChars [ j * 2 + 1 ] = hexArray [ v & 0x0F ] ; } retu...
Bytes to hex .
4,542
public static String checkSize ( byte [ ] value , int limitSize ) { if ( value != null ) { if ( value . length > limitSize ) { return bytesToHex ( value , limitSize - 3 ) + "..." ; } else return bytesToHex ( value , value . length ) ; } else return null ; }
Check size .
4,543
public static String formatParam ( Object value , String delimiter ) { if ( value != null ) { if ( byte [ ] . class . getSimpleName ( ) . equals ( value . getClass ( ) . getSimpleName ( ) ) ) { return checkSize ( ( byte [ ] ) value , VIEW_SIZE ) ; } String str = value . toString ( ) ; if ( str . length ( ) > VIEW_SIZE ...
format as sql parameter . If value is not null method will return value . If value is not null delimiter will be used to delimit return value . Otherwise defaultValue will be returned without delimiter .
4,544
public static String checkSize ( Object value , String defaultValue ) { return checkSize ( value , VIEW_SIZE , defaultValue ) ; }
limit string size to 32 .
4,545
public static String lowercaseFirstLetter ( String value ) { if ( value == null || value . length ( ) == 0 ) return "" ; char [ ] stringArray = value . toCharArray ( ) ; stringArray [ 0 ] = Character . toLowerCase ( stringArray [ 0 ] ) ; return new String ( stringArray ) ; }
Lowercase first letter .
4,546
public static void string2Writer ( String source , Writer out ) throws IOException { char [ ] buffer = source . toCharArray ( ) ; for ( int i = 0 ; i < buffer . length ; i ++ ) { out . append ( buffer [ i ] ) ; } out . flush ( ) ; }
String 2 writer .
4,547
public static String reader2String ( Reader source ) throws IOException { char [ ] cbuf = new char [ 65535 ] ; StringBuffer stringbuf = new StringBuffer ( ) ; int count = 0 ; while ( ( count = source . read ( cbuf , 0 , 65535 ) ) != - 1 ) { stringbuf . append ( cbuf , 0 , count ) ; } return stringbuf . toString ( ) ; }
Reader 2 string .
4,548
public static byte [ ] addDouble ( byte [ ] array , double value ) { byte [ ] holder = new byte [ 4 ] ; doubleTo ( holder , 0 , value ) ; return add ( array , holder ) ; }
Adds the double .
4,549
public static byte [ ] insertDoubleInto ( byte [ ] array , int index , double value ) { byte [ ] holder = new byte [ 4 ] ; doubleTo ( holder , 0 , value ) ; return insert ( array , index , holder ) ; }
Insert double into .
4,550
public static boolean equalsOrDie ( byte [ ] expected , byte [ ] got ) { if ( expected . length != got . length ) { throw new KriptonRuntimeException ( "Lengths did not match, expected length" + expected . length + "but got" + got . length ) ; } for ( int index = 0 ; index < expected . length ; index ++ ) { if ( expect...
Checks to see if two arrays are equals .
4,551
private void considerNotify ( ObserverWrapper observer ) { if ( ! observer . mActive ) { return ; } if ( ! observer . shouldBeActive ( ) ) { observer . activeStateChanged ( false ) ; return ; } if ( observer . mLastVersion >= mVersion ) { return ; } observer . mLastVersion = mVersion ; observer . mObserver . onChanged ...
Consider notify .
4,552
public void removeObserver ( final Observer < T > observer ) { assertMainThread ( "removeObserver" ) ; ObserverWrapper removed = mObservers . remove ( observer ) ; if ( removed == null ) { return ; } removed . detachObserver ( ) ; removed . activeStateChanged ( false ) ; }
Removes the given observer from the observers list .
4,553
public T getValue ( ) { Object data = mData ; if ( data != NOT_SET ) { return ( T ) data ; } return null ; }
Returns the current value . Note that calling this method on a background thread does not guarantee that the latest value set will be received .
4,554
public SQLProperty getPrimaryKey ( ) { for ( SQLProperty item : collection ) { if ( item . isPrimaryKey ( ) ) { return item ; } } SQLProperty id = findPropertyByName ( "id" ) ; return id ; }
True if there is a primary key .
4,555
private String buildTableName ( Elements elementUtils , SQLiteDatabaseSchema schema ) { tableName = getSimpleName ( ) ; tableName = schema . classNameConverter . convert ( tableName ) ; String temp = AnnotationUtility . extractAsString ( getElement ( ) , BindSqlType . class , AnnotationAttributeType . NAME ) ; if ( Str...
Builds the table name .
4,556
public Touple < SQLProperty , String , SQLiteEntity , SQLRelationType > findRelationByParentProperty ( String parentFieldName ) { for ( Touple < SQLProperty , String , SQLiteEntity , SQLRelationType > item : relations ) { if ( item . value0 . getName ( ) . equals ( parentFieldName ) ) { return item ; } } return null ; ...
find a relation specifing parent field name that is the name of the relation
4,557
static String extractWhereConditions ( boolean updateMode , SQLiteModelMethod method ) { final One < String > whereCondition = new One < String > ( "" ) ; final One < Boolean > found = new One < Boolean > ( null ) ; JQLChecker . getInstance ( ) . replaceVariableStatements ( method , method . jql . value , new JQLReplac...
Extract where conditions .
4,558
static boolean isIn ( TypeName value , Class < ? > ... classes ) { for ( Class < ? > item : classes ) { if ( value . toString ( ) . equals ( TypeName . get ( item ) . toString ( ) ) ) { return true ; } } return false ; }
Checks if is in .
4,559
public static Map < String , Object > parseMap ( AbstractContext context , ParserWrapper parserWrapper , Map < String , Object > map ) { switch ( context . getSupportedFormat ( ) ) { case XML : throw ( new KriptonRuntimeException ( context . getSupportedFormat ( ) + " context does not support parse direct map parsing" ...
Parse a map .
4,560
static Map < String , Object > parseMap ( AbstractContext context , JsonParser parser , Map < String , Object > map , boolean skipRead ) { try { String key ; Object value ; if ( ! skipRead ) { parser . nextToken ( ) ; } if ( parser . currentToken ( ) != JsonToken . START_OBJECT ) { throw ( new KriptonRuntimeException (...
Parse map .
4,561
static List < Object > parseList ( AbstractContext context , JsonParser parser , List < Object > list , boolean skipRead ) { try { if ( ! skipRead ) { parser . nextToken ( ) ; } if ( parser . currentToken ( ) != JsonToken . START_ARRAY ) { throw ( new KriptonRuntimeException ( "Invalid input format" ) ) ; } skipRead = ...
Parse a list .
4,562
public static BinderContext bind ( BinderType format ) { BinderContext binder = binders . get ( format ) ; if ( binder == null ) throw new KriptonRuntimeException ( String . format ( "%s format is not supported" , format ) ) ; return binder ; }
retrieve binding context for specified data format .
4,563
public static String readText ( InputStream inputStream ) { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line ; StringBuilder stringBuilder = new StringBuilder ( ) ; try { while ( ( line = bufferedReader . readLine ( ) ) != null ) { stringBuilder . append ( line ...
Read text .
4,564
private Class < ? > defineMapClass ( ParameterizedTypeName mapTypeName ) { if ( mapTypeName . rawType . toString ( ) . startsWith ( Map . class . getCanonicalName ( ) ) ) { return HashMap . class ; } else if ( mapTypeName . rawType . toString ( ) . startsWith ( SortedMap . class . getCanonicalName ( ) ) ) { return Tree...
Define map class .
4,565
private String fillClazz ( String configClazz , String clazz ) { if ( ! clazz . equals ( configClazz ) ) { return configClazz ; } else { return null ; } }
Fill clazz .
4,566
public void addEntity ( SQLiteEntity value ) { entities . put ( value . getName ( ) , value ) ; entitiesBySimpleName . put ( value . getSimpleName ( ) . toString ( ) . toLowerCase ( ) , value ) ; Set < SQLProperty > listEntity = null ; for ( SQLProperty p : value . getCollection ( ) ) { listEntity = propertyBySimpleNam...
Adds the entity .
4,567
private void checkName ( Set < SQLProperty > listEntity , SQLProperty p ) { for ( SQLProperty item : listEntity ) { AssertKripton . assertTrueOrInvalidPropertyName ( item . columnName . equals ( p . columnName ) , item , p ) ; } }
property in different class but same name must have same column name .
4,568
public Finder < SQLProperty > getEntityBySimpleName ( String entityName ) { if ( entityName == null ) return null ; SQLiteEntity result = entitiesBySimpleName . get ( entityName . toLowerCase ( ) ) ; if ( result != null ) return result ; for ( GeneratedTypeElement item : this . generatedEntities ) { if ( item . typeSpe...
Gets the entity by simple name .
4,569
public Set < SQLProperty > getPropertyBySimpleName ( String propertyName ) { if ( propertyName == null ) return null ; return this . propertyBySimpleName . get ( propertyName . toLowerCase ( ) ) ; }
Gets the property by simple name .
4,570
public String findColumnNameByPropertyName ( SQLiteModelMethod method , String propertyName ) { Set < SQLProperty > propertiesSet = getPropertyBySimpleName ( propertyName ) ; Set < String > set = new HashSet < String > ( ) ; String result = null ; for ( SQLProperty item : propertiesSet ) { result = item . columnName ; ...
get a .
4,571
public ClassName getGeneratedClass ( ) { String packageName = getElement ( ) . asType ( ) . toString ( ) ; return TypeUtility . className ( packageName . substring ( 0 , packageName . lastIndexOf ( "." ) ) + "." + getGeneratedClassName ( ) ) ; }
Gets the generated class .
4,572
public static void renameTablesWithPrefix ( SQLiteDatabase db , final String prefix ) { Logger . info ( "MASSIVE TABLE RENAME OPERATION: ADD PREFIX " + prefix ) ; query ( db , null , QueryType . TABLE , new OnResultListener ( ) { public void onRow ( SQLiteDatabase db , String name , String sql ) { sql = String . format...
Add to all table a specifix prefix .
4,573
public static void dropTablesWithPrefix ( SQLiteDatabase db , String prefix ) { Logger . info ( "MASSIVE TABLE DROP OPERATION%s" , StringUtils . ifNotEmptyAppend ( prefix , " WITH PREFIX " ) ) ; drop ( db , QueryType . TABLE , prefix ) ; }
Drop all table with specific prefix .
4,574
public static void dropTablesAndIndices ( SQLiteDatabase db ) { drop ( db , QueryType . INDEX , null ) ; drop ( db , QueryType . TABLE , null ) ; }
Drop tables and indices .
4,575
public static String detectSourceType ( Element element , String adapterClazz ) { TypeElement a = BaseProcessor . elementUtils . getTypeElement ( adapterClazz ) ; for ( Element i : BaseProcessor . elementUtils . getAllMembers ( a ) ) { if ( i . getKind ( ) == ElementKind . METHOD && "toJava" . equals ( i . getSimpleNam...
Detect source type .
4,576
public static String detectSourceType ( SQLiteModelMethod method , TypeName adapterTypeName ) { TypeElement a = BaseProcessor . elementUtils . getTypeElement ( adapterTypeName . toString ( ) ) ; for ( Element i : BaseProcessor . elementUtils . getAllMembers ( a ) ) { if ( i . getKind ( ) == ElementKind . METHOD && "toJ...
Give a param with type adapter obtain type used to convert param
4,577
protected void ensureElementsCapacity ( ) { final int elStackSize = elName . length ; final int newSize = ( depth >= 7 ? 2 * depth : 8 ) + 2 ; if ( TRACE_SIZING ) { System . err . println ( getClass ( ) . getName ( ) + " elStackSize " + elStackSize + " ==> " + newSize ) ; } final boolean needsCopying = elStackSize > 0 ...
Ensure elements capacity .
4,578
protected void ensureNamespacesCapacity ( ) { final int newSize = namespaceEnd > 7 ? 2 * namespaceEnd : 8 ; if ( TRACE_SIZING ) { System . err . println ( getClass ( ) . getName ( ) + " namespaceSize " + namespacePrefix . length + " ==> " + newSize ) ; } final String [ ] newNamespacePrefix = new String [ newSize ] ; fi...
Ensure namespaces capacity .
4,579
public void setFeature ( String name , boolean state ) throws IllegalArgumentException , IllegalStateException { if ( name == null ) { throw new IllegalArgumentException ( "feature name can not be null" ) ; } if ( FEATURE_NAMES_INTERNED . equals ( name ) ) { namesInterned = state ; } else if ( FEATURE_SERIALIZER_ATTVAL...
Sets the feature .
4,580
public boolean getFeature ( String name ) throws IllegalArgumentException { if ( name == null ) { throw new IllegalArgumentException ( "feature name can not be null" ) ; } if ( FEATURE_NAMES_INTERNED . equals ( name ) ) { return namesInterned ; } else if ( FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE . equals ( name ) ) ...
Gets the feature .
4,581
protected void rebuildIndentationBuf ( ) { if ( doIndent == false ) return ; final int maxIndent = 65 ; int bufSize = 0 ; offsetNewLine = 0 ; if ( writeLineSepartor ) { offsetNewLine = lineSeparator . length ( ) ; bufSize += offsetNewLine ; } maxIndentLevel = 0 ; if ( writeIndentation ) { indentationJump = indentationS...
For maximum efficiency when writing indents the required output is pre - computed This is internal function that recomputes buffer after user requested chnages .
4,582
public void setProperty ( String name , Object value ) throws IllegalArgumentException , IllegalStateException { if ( name == null ) { throw new IllegalArgumentException ( "property name can not be null" ) ; } if ( PROPERTY_SERIALIZER_INDENTATION . equals ( name ) ) { indentationString = ( String ) value ; } else if ( ...
Sets the property .
4,583
public void setOutput ( OutputStream os , String encoding ) throws IOException { if ( os == null ) throw new IllegalArgumentException ( "output stream can not be null" ) ; reset ( ) ; if ( encoding != null ) { out = new OutputStreamWriter ( os , encoding ) ; } else { out = new OutputStreamWriter ( os ) ; } }
Sets the output .
4,584
public void startDocument ( String encoding , Boolean standalone ) throws IOException { @ SuppressWarnings ( "unused" ) char apos = attributeUseApostrophe ? '\'' : '"' ; if ( attributeUseApostrophe ) { out . write ( "<?xml version='1.0'" ) ; } else { out . write ( "<?xml version=\"1.0\"" ) ; } if ( encoding != null ) {...
Start document .
4,585
@ SuppressWarnings ( "unused" ) public void setPrefix ( String prefix , String namespace ) throws IOException { if ( startTagIncomplete ) closeStartTag ( ) ; if ( prefix == null ) { prefix = "" ; } if ( ! namesInterned ) { prefix = prefix . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( prefix ) ; } e...
Sets the prefix .
4,586
protected String getPrefix ( String namespace , boolean generatePrefix , boolean nonEmpty ) { if ( ! namesInterned ) { namespace = namespace . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( namespace ) ; } if ( namespace == null ) { throw new IllegalArgumentException ( "namespace must be not null" + g...
Gets the prefix .
4,587
private String generatePrefix ( String namespace ) { while ( true ) { ++ autoDeclaredPrefixes ; final String prefix = autoDeclaredPrefixes < precomputedPrefixes . length ? precomputedPrefixes [ autoDeclaredPrefixes ] : ( "n" + autoDeclaredPrefixes ) . intern ( ) ; for ( int i = namespaceEnd - 1 ; i >= 0 ; -- i ) { if (...
Generate prefix .
4,588
protected void closeStartTag ( ) throws IOException { if ( finished ) { throw new IllegalArgumentException ( "trying to write past already finished output" + getLocation ( ) ) ; } if ( seenBracket ) { seenBracket = seenBracketBracket = false ; } if ( startTagIncomplete || setPrefixCalled ) { if ( setPrefixCalled ) { th...
Close start tag .
4,589
private void writeNamespaceDeclarations ( ) throws IOException { for ( int i = elNamespaceCount [ depth - 1 ] ; i < namespaceEnd ; i ++ ) { if ( doIndent && namespaceUri [ i ] . length ( ) > 40 ) { writeIndent ( ) ; out . write ( " " ) ; } if ( "" . equals ( namespacePrefix [ i ] ) ) { out . write ( " xmlns:" ) ; out ....
Write namespace declarations .
4,590
public XMLSerializer endTag ( String namespace , String name ) throws IOException { seenBracket = seenBracketBracket = false ; if ( namespace != null ) { if ( ! namesInterned ) { namespace = namespace . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( namespace ) ; } } if ( namespace != elNamespace [ de...
End tag .
4,591
public void entityRef ( String text ) throws IOException { if ( startTagIncomplete || setPrefixCalled || seenBracket ) closeStartTag ( ) ; if ( doIndent && seenTag ) seenTag = false ; out . write ( '&' ) ; out . write ( text ) ; out . write ( ';' ) ; }
Entity ref .
4,592
public void ignorableWhitespace ( String text ) throws IOException { if ( startTagIncomplete || setPrefixCalled || seenBracket ) closeStartTag ( ) ; if ( doIndent && seenTag ) seenTag = false ; if ( text . length ( ) == 0 ) { throw new IllegalArgumentException ( "empty string is not allowed for ignorable whitespace" + ...
Ignorable whitespace .
4,593
protected void writeAttributeValue ( String value , Writer out ) throws IOException { final char quot = attributeUseApostrophe ? '\'' : '"' ; final String quotEntity = attributeUseApostrophe ? "&apos;" : "&quot;" ; int pos = 0 ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char ch = value . charAt ( i ) ; if ( c...
Write attribute value .
4,594
private static void addPrintable ( StringBuffer retval , char ch ) { switch ( ch ) { case '\b' : retval . append ( "\\b" ) ; break ; case '\t' : retval . append ( "\\t" ) ; break ; case '\n' : retval . append ( "\\n" ) ; break ; case '\f' : retval . append ( "\\f" ) ; break ; case '\r' : retval . append ( "\\r" ) ; bre...
Adds the printable .
4,595
public void writeBinary ( byte [ ] value , int start , int length ) throws IOException { text ( Base64Utils . encode ( value , start , length ) ) ; }
Write binary .
4,596
public void writeDecimalAttribute ( String prefix , String namespaceURI , String localName , BigDecimal value ) throws Exception { this . attribute ( namespaceURI , localName , value . toPlainString ( ) ) ; }
Write decimal attribute .
4,597
public void writeIntegerAttribute ( String prefix , String namespaceURI , String localName , BigInteger value ) throws Exception { this . attribute ( namespaceURI , localName , value . toString ( ) ) ; }
Write integer attribute .
4,598
public void writeDoubleAttribute ( String prefix , String namespaceURI , String localName , double value ) throws Exception { this . attribute ( namespaceURI , localName , Double . toString ( value ) ) ; }
Write double attribute .
4,599
public void writeBooleanAttribute ( String prefix , String namespaceURI , String localName , boolean value ) throws Exception { this . attribute ( namespaceURI , localName , Boolean . toString ( value ) ) ; }
Write boolean attribute .